Skip to content

Instantly share code, notes, and snippets.

@thespacedoctor
Created February 15, 2019 21:59
Show Gist options
  • Save thespacedoctor/38fe4beac4de6ac0b16d080565abfd58 to your computer and use it in GitHub Desktop.
Save thespacedoctor/38fe4beac4de6ac0b16d080565abfd58 to your computer and use it in GitHub Desktop.
[Filepath from Preview Mac App] #pdf #preview #applescript #filepath
tell application "System Events"
tell process "Preview"
set thefile to value of attribute "AXDocument" of window 1
end tell
end tell
-- macos comes with php installed you can decode this file name using php
return do shell script "php -r 'echo urldecode(\"" & thefile & "\");'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment