RandmTask Posted March 29, 2023 Share Posted March 29, 2023 Hi Im sure this is a simple question, but here goes, Im trying to use this applescript to open a PDF to a specific page in Preview eg. page 55: Quote tell application "Preview" activate open "/Users/user/Downloads/myfile.pdf" tell application "System Events" keystroke "55" using {command down} end tell end tell And I am getting this error: The file couldn't be opened because you don't have permission to view it. To view or change permissions, select the item in the Finder and choose File > Get Info. Permissions seem to be fine in Get Info however. And I can open the file normally in Alfred just fine using the "Open File" Ive tried other files with the same result. Any ideas? Link to comment
Stephen_C Posted March 29, 2023 Share Posted March 29, 2023 Try this: tell application "Preview" activate set theFile to POSIX file "/Users/user/Downloads/myfile.pdf" open theFile tell application "System Events" keystroke "55" using {command down} end tell end tell However, I think you have to keystroke ⌥⌘G 55 to get to the page you want—and you may have to include a short delay before the 55. Stephen RandmTask 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now