Scripting Preview

does anyone out there know if there is a way to give preview commands without driving the GUI like a service or can will it accept a command line ?

Hi, is (a bit) scriptable, but you must enable it manually.
Open the Terminal and type (better copy :wink: ) this:

defaults write /Applications/ NSAppleScriptEnabled -bool YES

ok I ran that but I got back some stuff I’ve never seen before… I take it this makes it so I can give it a command from terminal ?

See also: Minimal Scriptability

Edit: mcgrailm, it turns on some very basic AppleScript support.

hmm in either case I am unable to set that value to true as it doesn’t seem to exist for that app

what I’m really trying to do is get preview to convert a PS to PDF as pstopdf makes a much llarger file than if I save the PS to PDF from Preview

what about through Xcode is there some way I can get that same result there ?

I don’t get any output from that command; Maybe we can help if you post that “stuff.”

Do you use Panther?
Then try the boolean value 1 instead of YES

here it is

I think you’re missing a space after “write.” :slight_smile:

I opened the info.plist and its not there

Can you add it yourself?

no I don’t have permission

I thought that would be the case. Unless you can use sudo, you’ll have to find a different way to do what you want.

Side note: You typed “Scripter” instead of “Script”

Ok thank you all for your help …

I knew, why I wrote


In 10.7 Info.plists are owned by root:

sudo defaults write /Applications/ NSAppleScriptEnabled -bool true sudo chmod 644 /Applications/ sudo codesign -f -s - /Applications/
Now tell app “Preview” to windows shouldn’t cause an error. As in 10.6, Preview still won’t have a dictionary.