Repeat over files in a File > Open dialog with Applescript
- by GotNoSugarBaby
In the below script I use an Application other than Finder to launch an "Open" browser and perform a search in it.
I've got the window into the state I want, but whatever I try can't access the list of files to repeat over.
If anyone can help by adding the code to repeat over that file list and log out the file path of each file it'd be a huge help.
Thanks a lot.
tell application "Preview"
-- start the app
activate
-- let it boot up
delay 3
-- ensure it still has focus
activate
end tell
tell application "System Events"
tell process "Preview"
-- spawn "Open" window
keystroke "o" using {command down}
delay 0.5
-- spawn "Go to" window
keystroke "g" using {command down, shift down}
delay 0.5
-- expand scope of search to all of this mac
keystroke "/"
keystroke return
delay 0.5
-- spawn search field
keystroke "f" using {command down}
delay 0.5
-- perform search
keystroke ".jpg OR .jpeg"
keystroke return
end tell
end tell