I’m writing a script to automate the process of exporting projects.
It’s a simple keystroke loop.
What I need is a way to wait for certain dialog boxes to open and close to pause/proceed with the loop. I’ve used Accessibility Inspector to figure out the input I need, but it’s not working. What am I doing wrong?
First, I wait for an Export Settings window to pop up.
repeat until (exists window "Export Audio/Video" of application process "Live")
delay 1.5
end repeat
Second, I wait for the Export Progress window to close:
repeat while (exists window "Export Audio..." of application process "Live")
delay 0.2
end repeat
Do you see anything to fix there? Am I SOL?
Cheers
Its hard to tell since you only provide code snippets instead of compilable examples.
I’m guessing that those code segments are inside a tell application “System Events” : End Tell block
Yes, they are inside tell application “System Events” : end tell
e.g.:
tell application "System Events"
repeat until (exists window "Documents" of application process "Finder")
delay 0.5
end repeat
end tell
^^ that works for me, no problem. I see the script running until I open Documents.
if I try
tell application "System Events"
repeat until (exists window "Export Audio/Video" of application process "Live")
delay 0.5
end repeat
end tell
The script will run forever no matter how many times I open the Export Audio/Video window. I’m wondering if it’s an AX thing? can I only call it with the window title? Can I do something with the class (TCocoaWindow)? If so, what would the syntax be? Or any other way…
FWIW, I use Accessibility Inspector on the rest of the app and it’s basically just one big window with no discrete elements picked up by the inspector. I’m not sure what that means, but it makes me ask if it’s a dead-end i really hope not
OK,
It could be that the name of the Window is incorrect or has some odd invisible character in it
add the line below to your script to get a list of all windows’ names
get name of windows of application process “Live”
tell application "System Events"
set WinList to name of windows of application process "Live"
end tell
repeat with i in WinList
display alert i
end repeat
If you have ScriptDebugger, you can peruse the items in the list to see if it is spelled correctly
EDIT – Just realized that the windows in “Live” are not Mac windows but unix style windows
Live seems to be some sort of port from a unified “UNIX” codebase. All elements on the windows are not Mac style, instead look like X11. Probably wont be able to GUI script it
thank you robertfern!
I ran your script and came up with a dialog that was blank.
So, I tried leaving it blank!
tell application "System Events"
repeat while (exists window "" of application process "Live")
delay 0.5
end repeat
end tell
et voilà! :lol:
I guess there won’t be any distinction between pop ups in Live, but it works just fine for my purposes.
Again, thank you thank you so much!
I’m new to the forum, do I mark this thread [SOLVED] in the title?
Hi escoolioinglesias. Welcome to MacScripter.
We don’t have any particular tradition of marking topics as [solved], but it’s a nice idea.
Our tags for posting AppleScript code are [applescript] and [/applescript]. They make the code appear in a box with a clickable link, as in robertfern’s replies. There’s a button for them just above the text field when you post.
Thank you for the welcome, Nigel
I’ve fixed all of my previously quoted scripts to the appropriate Applescript quotes, but haven’t found a way to edit the title of post.
Cheers