Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I saw this post:

http://superuser.com/questions/155517/how-do-i-get-applescript-to-work-with-preview-in-snow-leopard

In my attempt to figure out how to use AppleScript with Preview. I'm trying to automate a series of tasks that will open documents and resize them automatically to the most efficient view in situations where I need to view multiple documents at once. I can't figure out how to add scripting functionality in Preview (meaning simply, I can't get Automator or AppleScript to resize preview windows automatically). I saw this thread but there was no answer. I'm wondering if you've figured anything out since then.

share|improve this question
add comment

2 Answers 2

My answer to that post you mention has a link to this macscripter.net thread which shows a terminal command (defaults write /Applications/Preview.app/Contents/Info NSAppleScriptEnabled -bool YES) that turns on basic scripting for Preview.

One of the links on that thread is to this red-sweater.com blog post, which explains in depth how to resize document windows in Preview.

So I guess I had answered that question. :)

share|improve this answer
    
WARNING: Don't follow ghoppe's suggestion above for the Lion (10.7) version of Preview. Changing anything inside of the application's executable will invalidate the code signing check and cause Preview not to open. Worse, it's really difficult to get the Preview application working again without access to another system running Lion -- you can't just "undo" the property list edit to roll back to a working version! –  user92958 Aug 4 '11 at 23:06
add comment

In Mac OS Lion the Info.plist owns you:

sudo defaults write /Applications/Preview.app/Contents/Info NSAppleScriptEnabled -bool true
sudo chmod 644 /Applications/Preview.app/Contents/Info.plist
sudo codesign -f -s - /Applications/Preview.app

Now this shouldn't cause an error:

tell app "Preview" to windows

As in 10.6, Preview still won't have a dictionary.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.