Minipulate "hidden" menus and windows

I’m not familiar with Abelton Live, but the script you included in your post is an example of GUI AppleScript, and is reliable as long as the app developers don’t change the accessibility features or app interface too much.

Side note: when posting scripts, enclose the entire thing in three backticks (the character to the left of the 1 key: `), beginning and end, and it will preserve the formatting. For instance, your script would look like this:

tell application "System Events"
	tell application process "Dropbox"
		tell menu bar 2
			tell menu bar item 1
				tell menu 1
					if exists of menu item "Pause Syncing" then
						tell menu item "Pause Syncing"
							perform action "AXPress"
						end tell
					end if
				end tell
			end tell
		end tell
	end tell
end tell

All that being said, take a look at Script Debugger, as it far superior to Apple’s own Script Editor app. You can look through Ableton’s AppleScript dictionary to see if there are any built-in ways to do what you need. If not, then the aforementioned GUI scripting is the only way to do it.

For instance, to simulate clicking the close button, the following works (using Finder as an example):

tell application "System Events"
	tell application process "Finder"
		click button 1 of window 1
	end tell
end tell

You might be able to do the same with Ableton’s plugin windows, however, the window 1 portion would need to be changed to point to whatever window index the plugin has. If you need to get information on all front application windows, look at the Front Window Analysis Tool that @ccstone wrote sometime back that I (and many others) use quite extensively.

Alternatively, if the plugin windows each have a specific, and unchanging name, you can do something like the following:

tell application "System Events"
	tell application process "Finder"
		click button 1 of window "Downloads"
	end tell
end tell

That will ensure the right window closes, irregardless of it’s window index, but again, it has to have a name, and one that does not change.

1 Like