How can I use AppleScript to refer to a dialog box in Ableton Live?
I have a collection of Ableton Live files (extension ".als") that I need to iterate over while playing. I would like to highlight the keyboard shortcut to launch each one and intended to use AppleScript to do so.
The problem is that every file changes as I watch the playback of the linked song, so when I press the keyboard shortcut to launch the .als associated with the next song in my set, Ableton opens "Save changes before closing?" (at what point I want to do this, select "Do not save").
Simply hitting + D at this point will do the trick, but I'd really like to automate that pressing. I can't figure out how to make applescript for this. I'm an applescript noob, and clicking the "Open Dictionary" button in AS seems to indicate that Ableton is not officially a scripted application.
Any thoughts on this? Here is the AppleScript example I tried. This will start the process of opening the next .als in my list, but it doesn't click the Don't Save button.
tell application "Finder"
activate
open document file "Song 1.als" of folder "Desktop" of folder "User" of folder "Users" of startup disk
end tell
tell application "System Events"
keystroke "d" using command down
end tell
source to share
Interesting!
Finally came across some clues that made it work:
- Add both Script and Ableton Live editors to API Accessibility: System Preferences> Security & Privacy> Privacy ...
- Ignore application responses to continue Script during dialogue.
LiveLoader.scpt:
-- open file
ignoring application responses -- don't wait for user input
tell application "Ableton Live 9 Suite" to open "Users:username:Desktop:LiveSet Project:LiveSet.als"
end ignoring
-- use delay if needed
-- delay 0.5
-- skip saving file
tell application "System Events"
set frontmost of process "Live" to true
key code 123 -- left
key code 123 -- left
keystroke return -- enter
end tell
Note:
Consider possible security implications.
Maybe just disable apps in the privacy list after use. (Could be script;)
Now you can also click mouse clicks for more creativity. :)
source to share
I know this is old. but in the interest of helping others who might be here ... here's what I did.
use a programmatic call to Qlab. the free version will be fine. make an application tip. go to the "trigger" tab. select midi trigger. press the midi key you would like to assign to the command as well. this cue now fires when it receives this midi note - even when running in the background. go to the "script" tab. copy and paste the script below.
you can make the appropriate adjustments for each song. Basically, each key closes all current files in non-save mode - on demand. and then launch a specific live set. which was ever appointed. in this case the song "Less Than Nothing"
code...
tell application "System Events"
set frontmost of process "Live" to true
keystroke "q" using command down
tell application "System Events" to keystroke (ASCII character 28) --left arrow
tell application "System Events" to keystroke (ASCII character 28) --left arrow
keystroke return
end tell
delay 2.0
do shell script "open '/Users/CamMac/Desktop/Less Than Nothing 2 .als' "
source to share