Pause actions until the pop up window is gone in Pro Tools - AppleScript

Hi all!
This may be a specific question for Pro Tools users.
I would like to automate a process using this plugin:

The first step is click in the 'Analyze' bottom, then a pop up window will appear while is rendering:

Once the analyze process has been completed, the pop up window will desapeared and I will need to click in 'Render'

At the moment I got this, which click in analyze

activate application "Pro Tools"

tell application "System Events"
	tell process "Pro Tools"
		click button "Analyze" of the front window
	end tell
end tell

But I don't know how to express the 'Pause until Conditions are met' in AppleScript in order to avoid working with images.

Does anyone know the expression for this?

Thank you very much!

I don't know Pro Tools at all, so I don't know how "real" that Cancel button is, but you could try an Until action, with a Button activation set to "Until Cancel button does not exist."

-rob.

2 Likes

Hi Rob!
Indeed that was a great solution!

My next step is being able to let Pro Tools work in the background while I'm checking my emails (for example) or doing another task outside Pro Tools.

At the moment this macro calls in front Pro Tools making it impossible to do another task.
Is there any solution for this?

TEST_Mastering - Loudness Control.kmmacros (9.2 KB)

I'm not sure I understand what you're asking for? If that window is modal (blocking), then you may be able to switch to another app, but the window will be onscreen until it's done.

-rob.

Hi,

Basically I'm looking for a way to switch between apps while Pro Tools is in the background analyzing and rendering an X number of files.

I thought without the necessity of relying on images, this would be able to work. But because the maco I attached activates Pro Tools, the app is back to the front....

It wouldn't be a problem if any modal window is on screen while I'm using another app but it looks like the macro gets cancelled, stopping and not analysing and rendering the files.

The macro should keep running in the background, I don't see why it wouldn't. If it stops when you switch, look at the log files (you can open them via Help > Open Logs Folder) to see if there's an error message?

-rob.

Yep, Logs are showing errors related with not being able to find 'Analyze' this is because I switched to another app hoping to let Pro Tools follow the script in the background

2023-11-20 16:43:33 Execute an AppleScript failed with script error: text-script:57:104: execution error: System Events got an error: Can’t get button "Analyze" of window 1 of process "Pro Tools". (-1728). Macro “TTTESSST_Loudness Control” cancelled (while executing Execute AppleScript).
2023-11-20 16:43:51 Execute macro “TTTESSST_Loudness Control” from trigger The Hot Key ⌃⌄⌘= is pressed
2023-11-20 16:44:05 Execute an AppleScript failed with script error: text-script:57:104: execution error: System Events got an error: Can’t get button "Analyze" of window 1 of process "Pro Tools". (-1728)
2023-11-20 16:44:05 Execute an AppleScript failed with script error: text-script:57:104: execution error: System Events got an error: Can’t get button "Analyze" of window 1 of process "Pro Tools". (-1728). Macro“TTTESSST_Loudness Control” cancelled (while executing Execute AppleScript).

That makes sense; if it can't see the window, it can't click the button. You could bring it to the foreground again, but that would make working in the background a real pain.

-rob.