Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is Preview scriptable?



"Michelle Steiner" wrote:

> On Jan 27, 2008, at 2:57 PM, Graham Sims wrote:
> 
>> I am convinced I had the following script working in Preview to
>> position and set the size of the frontmost window
> 
> Preview is not scriptable.  To find out whether an application is
> scriptable, drag its icon onto the Script Editor icon; if it is
> scriptable, Script Editor will open its dictionary.  Otherwise, Script
> Editor will tell you that it is not scriptable.

You can turn on the Plist property that provides some basic scriptability to
Preview.  I do this, so that I can send files opened in Preview over to Skim
PDF reader.

Run this script in Script Editor:

tell application "Finder"
   set the Preview_app to (application file id "com.apple.Preview") as alias
   duplicate Preview_app
end tell
set the plist_filepath to the quoted form of ¬
   ((POSIX path of the Preview_app) & "Contents/Info")
do shell script "defaults write " & the plist_filepath & space ¬
  & "NSAppleScriptEnabled -bool YES"


This works in Preview in Leopard.  Duplicate your copy of Preview first, so
that you have a fallback in case something gets botched.

--
Gary


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Re: Is Preview scriptable? (From: Michelle Steiner <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.