You are not logged in.
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 ?
Offline
Hi,
Preview.app is (a bit) scriptable, but you must enable it manually.
Open the Terminal and type (better copy
) this:
Code:
defaults write /Applications/Preview.app/Contents/Info NSAppleScriptEnabled -bool YES
Offline
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 ?
Offline
See also: Minimal Scriptability
Edit: mcgrailm, it turns on some very basic AppleScript support.
Offline
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 ?
Offline
mcgrailm wrote:
ok I ran that but I got back some stuff I've never seen before
I don't get any output from that command; Maybe we can help if you post that "stuff."
Offline
here it is
McGrail:~ mcgrail$ defaults write/Applications/Preview.app/Contents/Info NSAppleScripterEnabled -bool YES
Command line interface to a user's defaults.
Syntax:
'defaults' [-currentHost | -host <hostname>] followed by one of the following:
read shows all defaults
read <domain> shows defaults for given domain
read <domain> <key> shows defaults for given domain, key
read-type <domain> <key> shows the type for the given domain, key
write <domain> <domain_rep> writes domain (overwrites existing)
write <domain> <key> <value> writes key for domain
rename <domain> <old_key> <new_key> renames old_key to new_key
delete <domain> deletes domain
delete <domain> <key> deletes key in domain
domains lists all domains
find <word> lists all entries containing word
help print this help
<domain> is ( <domain_name> | -app <application_name> | -globalDomain )
or a path to a file omitting the '.plist' extension
<value> is one of:
<value_rep>
-string <string_value>
-data <hex_digits>
-int[eger] <integer_value>
-float <floating-point_value>
-bool[ean] (true | false | yes | no)
-date <date_rep>
-array <value1> <value2> ...
-array-add <value1> <value2> ...
-dict <key1> <value1> <key2> <value2> ...
-dict-add <key1> <value1> ...
Offline
I think you're missing a space after "write." ![]()
Offline
I opened the info.plist and its not there
Offline
Can you add it yourself?
Offline
no I don't have permission
Offline
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"
Offline
Ok thank you all for your help ......
Offline
In 10.7 Info.plists are owned by root:
Code:
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 tell app "Preview" to windows shouldn't cause an error. As in 10.6, Preview still won't have a dictionary.
Last edited by l-ri (2011-08-04 07:50:28 pm)
Offline