Re: Will this work?
Re: Will this work?
- Subject: Re: Will this work?
- From: Ben Waldie <email@hidden>
- Date: Tue, 17 Jun 2008 11:26:49 -0400
Hi Oakley,
I found this at MacTECH in an article on scripting PhotoShop.
I can not get it to compile
It fails on the set theFormat line.
I don't understand that line either.
Can anyone explain what is going on there?
Dose it to work on your system or is it just mine?
OS 10.4.11
Figure 5. Photoshop's Save For Web Export Options
The following example code will save an image in JPEG format via
Photoshop's Save For Web technology, using specified export options.
Due to a compilation issue with the as property of the save for web
options class, in order to specify a file format when exporting in
this format, a tricky workaround is necessary. Thanks to Nigel
Garvey's insightful MacScripter.net AppleScript BBS <http://bbs.applescript.net
> post for this great workaround!
tell application "Adobe Photoshop CS2"
set theFormat to run script "tell application \"Photoshop\" to
return {"class fltp":JPEG}"
set theExportOptions to {class:save for web export options,
interlaced:true, quality:30} & theFormat
tell theDocument
export in "Macintosh HD:Users:bwaldie:Desktop:My_Document.jpg"
as save for web with options theExportOptions
end tell
end tell
I actually wrote that article, although I don't recall exactly what
the problem was, and why a workaround was necessary. In any case, it
looks like some of the code in the article may have been improperly
formatted when pasted into the article, or brought to the web. I'm
afraid that I don't have CS2 installed on my machine at the moment,
but I did do some testing with CS3. In my tests, both of the
following adjusted versions worked:
Example 1:
----------
tell application "Adobe Photoshop CS3"
set theFormat to run script "tell application \"Adobe Photoshop CS3\"
to return {web format:JPEG}"
set theExportOptions to {class:save for web export options,
interlaced:true, quality:30} & theFormat
tell document 1
export in "Macintosh HD:Users:bwaldie:Desktop:My_Document.jpg" as
save for web with options theExportOptions
end tell
end tell
Example 2:
----------
tell application "Adobe Photoshop CS3"
tell document 1
export in "Macintosh HD:Users:bwaldie:Desktop:My_Document2.jpg" as
save for web with options {class:save for web export options,
interlaced:true, quality:30, web format:JPEG}
end tell
end tell
Hope this helps.
-Ben
Ben Waldie
President
Automated Workflows, LLC
610.935.0652
=============================================
AppleScript * Automator * Workflow Automation
Products, Training, Custom Development Services
<http://www.automatedworkflows.com>
=============================================
_______________________________________________
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