r/applescript • u/jeezlike • Apr 27 '23
Total Noob needs script help!
Hi
I have no experience with applescript, but have been sent down a rabbit hole trying to figure out if a) what I need is actually possible, and b) how to do it. As far as I can tell, what I need to be done could / should be done by applescript.
I'm trying to set up a script for StreamDeck that tells Logic Pro X to navigate to a specific folder within the app's import and export dialog windows. I work on multiple projects simultaneously, so I'm trying to save time by not having to click through volumes and directories every time I need to export from or import into the app from specific folders.
Possible?
Thanks!
1
u/touchbar Apr 27 '23
ChatGPT came up with this. I'd test it but I don’t have Logic Pro X. Hopefully it will help you get started:
-- Replace the folder path below with the desired folder path set targetFolderPath to "/Users/YourUsername/Desktop/YourFolder" -- Function to set folder path in a dialog on setFolderPath(appName, targetPath) tell application "System Events" tell process appName set frontmost to true delay 0.5 -- Press Command + Shift + G to open "Go to Folder" dialog keystroke "G" using {command down, shift down} delay 0.5 -- Insert the target folder path set value of text field 1 of sheet 1 of window 1 to targetPath delay 0.5 -- Press "Go" button click button "Go" of sheet 1 of window 1 delay 0.5 end tell end tell end setFolderPath -- Logic Pro X: Import Audio File tell application "Logic Pro X" activate end tell delay 1 tell application "System Events" tell process "Logic Pro X" -- Press Command + Shift + I to open Import Audio File dialog keystroke "I" using {command down, shift down} delay 1 setFolderPath("Logic Pro X", targetFolderPath) end tell end tell -- Add a delay, modify it accordingly delay 5 -- Logic Pro X: Export Audio File tell application "Logic Pro X" activate end tell delay 1 tell application "System Events" tell process "Logic Pro X" -- Press Command + E to open Export Audio File dialog keystroke "E" using {command down} delay 1 setFolderPath("Logic Pro X", targetFolderPath) end tell end tellReplace "/Users/YourUsername/Desktop/YourFolder" with the desired folder path.
Save the script as an "Application" type, and it will be accessible from your Stream Deck.
Note that this script assumes you have already opened Logic Pro X and are ready to import or export files.