I have tried this but it doesn't work:
tell application "Preview"
set myfile to path of document 1 of window 1
end tell
I have verified that my Preview is scriptable (NSAppleScriptEnabled).
I have tried this but it doesn't work:
tell application "Preview"
set myfile to path of document 1 of window 1
end tell
I have verified that my Preview is scriptable (NSAppleScriptEnabled).
On my 10.6 system Preview doesn't have an Applescript dictionary. This is something that scriptable applications need. While Preview SAYS it can do Applescript, it really can't.
It has no way to translate the "path of document 1 of window 1" into anything meaningful.
Usually people use GUI Scripting to interact with Preview, or they find another way.
I did a little research and found this
tell application "System Events"
tell process "Preview"
set thefile to value of attribute "AXDocument" of window 1
end tell
end tell
which i found on macscripter