Pause Until Application Is Fully Loaded?

I did a search for this but couldn't quite find what I was looking for. I want to Pause Until an application is fully loaded and then continue the macro. Currently, in my macro, I am just using the Pause action to wait for a specified time before continuing. The problem is that I have more than one Mac, and the length of time needed to pause varies. I'd like to have the macro pause the minimum amount of time on each machine. Once the app is loaded, I can begin to perform other actions on it.

I tried Pause Until the Front Application Exists, but that doesn't work. The next action fires immediately. I also tried a second action where I Pause Until a specific menu item is Enabled, but that doesn't work either.

How can I get this to work? Thanks.

2 Likes

One option would be to use an ‘Until’ action that application is at the front.

For example, if I wanted to launch Safari and then do something in Safari, “Step One” could be something like this:

That should have the effect of doing “Pause Until Application is ready to use.”

Give that a try, if it doesn’t work, let me/us know and we’ll see what else we can think of.

Unfortunately, that doesn't work. The next action starts running as soon as Evernote starts to load.

My next step would be to add to the “UNTIL” portion of that block, and look for a menu item in Evernotes menu system. Once the menu item exists, I would assume Evernote is ready for you to start taking action.

Other possibilities:

  • “front window of front application exists” (as long as we know that application is Evernote)

  • “title of front window of front application contains {text}” (as long as we know that application is Evernote)

This one may be tricky because Evernote opens, but often isn't ready for prime time for a variable amount of time while it connects to the Evernote server. Meanwhile, the app is loaded, active, at front, and menus are there. That's my experience with the new Evernote anyway.

Maybe Pause Until Found Image Condition would work here.

Thanks, Evan. That's what I am finding. The menus are loaded, but you can't quite act on the menus yet.

Pauses until an application is at the front is not a viable solution for this because the application will “be at the front” almost immediately upon activating even though it’s not fully opened and ready to be used.

I can’t think of a great solution for you, except you could add an “If” action and for the condition select environment variable: username and put in your username. Then you could put in a timed pause specific to that particular device. Repeat this for each device and adjust the timed pause accordingly. This would allow you to set a different pause for each device.

I use this in some macros to differentiate between my iMac and my MBP. Since my username is different on them, I use that environment variable to have the macro do different things depending on which device it’s ran on. This won’t work obviously if the username is the same on each device, but there’s probably another environment variable that you could use to differentiate between them.

Hope this helps, and that somebody else who is more knowledgable than I chimes in with a better solution.

@michaelhyatt

Is the CPU usage predictably above a given number while the application is loading?

If so then you could write an Applescript to return the CPU usage and then add that result to your Pause statement:

image

I would imagine that would be difficult to reliably do since the CPU usage might vary greatly depending on the machine, and also what other processes are running at any given time, though it might work for OP.

Something that I just remembered however was you can add another condition to your pause until action, the "the front window exists". I use this for several apps (like Spotify) to make sure the app is actually loaded because some will "load" and "be at the front" but they're not actually open. But once the front window exists they are generally good to go. I imagine each application is a little different, but this is one way I have found to work well for some.

1 Like

You need two separate Actions:

  1. Activate Evernote
  2. Pause Until Evernote is frontmost

Since it seems you don't have a working answer yet, there is the following suggestion which works for me.

Two combined conditions:

  1. Evernote should be at the front
  2. The menu-item 'Quit Evernote' should be enabled

Choose menu-item you are waiting for to be enabled for your case.

Happy New Year

Very Special Fireworks

Thanks for that idea. Unfortunately, that doesn’t work. That menu item is enabled on Evernote before the notes database is fully loaded.

Unfortunately, this doesn't work.

I had the same problem back when using Photoshop and Illustrator. Both are active and frontmost for many seconds while loading libraries. I never could get that to work right.
In macOS Big Sur, I also see other apps taking a pretty long time to fully start.

tried Pause Until > Image found?

You have been given several suggestions, but you say none of them work. I use the suggestion I made in many of my macros, and it always works for me.

So, lets look at this from another perspective.
In your specific use case, you need to do something with Evernote after it has "fully loaded".
Exactly what do you want to do? A real-world example with screen shot, or even better, a video or animated GIF.
Then perhaps we can offer suggestions with might work in your specific use case.

BTW, I almost always start Evernote app when I first log in to my Mac for the day, and have never found this to be a problem. But then I'm still using Evernote 7.14 (458244) on macOS 10.14.6 (Mojave).
That means Evernote is always ready to respond later in the day.

While I don't use Evernote I do use many other applications that have a similar environment, i.e., menus are enabled and the application is frontmost before it is entirely ready to be acted on. What I've found is that there is always some menu item, somewhere, occasionally buried in a hierarchical menu item, that is not fully enabled until the app connects with the server (or a similar wait-until condition applies).

Search through all of your menus to determine which one might be slightly different and use the Pause Until action on that menu item. One that has worked for me in the past is a menu item that allows you to sync or reconnect with the server as that can't be enabled until the connection with the server is established.

Good luck.

4 Likes

Here's a quick screencast for you. I am using Evernote 10.5.7 (the current version) on macOS 11.1 (Big Sur). In this particular application, I can't always be sure Evernote is already loaded before the macro runs.

Thanks, Scott. This was a great suggestion. I figured out that the “Share Note...” menu item is not enabled until the program is fully loaded. I created a “Pause Until Menu Item is Enabled” action and specified the “Share Note...” as the menu item. The macro now works perfectly! Thanks again.

1 Like

So glad that this worked for you. I know how frustrating it can be to feel like you're one step away from the perfect macro. Great that you got it working!

2 Likes