Re: Imagemagick
Re: Imagemagick
- Subject: Re: Imagemagick
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 28 Nov 2007 09:33:05 -0500
Well, gee. My blackberry blew up while I was composing a reply and I
see that it's all solved. Yay!
The main point to remember is that "do shell script" does not inherit
the same environment you have in Terminal; it's a pretty barebones
shell. Whereas in Terminal, the PATH variable is set for you so you
can type just "identify" instead of
"/usr/ImageMagick-6.3.5/bin/identify", and the DYLD_LIBRARY_PATH is
variable is set for you so that the dynamic library loader can find
everything identify needs to actually run, you have to do anything
like that yourself if calling from do shell script.
Incidentally, you can shorten the shell script command a bit by
prepending the variable assignment with no 'export ' or semicolon,
e.g. something like this:
do shell script "DYLD_LIBRARY_PATH=/usr/ImageMagick-6.3.5/lib
/usr/ImageMagick-6.3.5/bin/identify " & quoted form of imageFileName
And for maintainability I would probably make the ImageMagick location
a property of the script, something like this:
property ImageMagickPrefix: "/usr/ImageMagick-6.3.5"
Which could then be used something like this:
on sic imCommand on fileList
if class of fileList is not "list" then
set params to quoted form of fileList
else
set params to ""
repeat with fileName in fileNames
if the length of params is greater than 0 then
set params to params & " "
end if
set params to params & quoted form of fileName
end repeat
end if
do shell script ¬
"DYLD_LIBRARY_PATH=" & quoted form of ImageMagickPrefix & "/lib" ¬
& " " & quoted form of ImageMagickPrefix & "/bin/" ¬
& quoted form of imCommand & " " & params
end sic
on identify(filename)
sic "identify" on filename
end identify
on convert(fromFile, toFile)
sic "convert" on {fromFile, toFile}
end convert
...
But now I'm getting carried away.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden