I've written an AppleScript to do as the title describes. It is supposed to go to a given folder, open each of the files one at a time in preview, click "file" on the menu bar, then click "Export as PDF...", then click enter to accept the dialog that will open. Repeat until there's no more files left to automate.
tell application "Finder" set fl to files of folder POSIX file "/Users/username/Desktop/Folder" as alias list end tell repeat with f in fl tell application "Preview" open f tell application "System Events" to tell process "Preview" click menu item "Export as PDF..." of menu 1 of menu bar item "File" of menu bar 1 end tell keystroke return end tell end repeat
I get the following error when it runs, it opens the file in Preview and stops. Any ideas?
The error isn't very descriptive.