Re: Photoshop 7 and Save for Web
Re: Photoshop 7 and Save for Web
- Subject: Re: Photoshop 7 and Save for Web
- From: Ron Bishop <email@hidden>
- Date: Wed, 31 Jul 2002 11:45:32 -0500
Here's a quick and dirty way to type in the filename and choose a
different folder location. (I'm sure a Javascripter could make this
cleaner.)
-------------------------
display dialog " Please enter a file name..." default answer ""
set theFileName to text returned of result
set theFileDestination to choose folder with prompt "Select a folder to
save into..."
set the FilePath to theFileDestination as string
set theJavascript to "{var id15 = charIDToTypeID( \"Expr\" );
var desc6 = new ActionDescriptor();
var id16 = charIDToTypeID( \"Usng\" );
var desc7 = new ActionDescriptor();
var id17 = charIDToTypeID( \"Op \" );
var id18 = charIDToTypeID( \"SWOp\" );
var id19 = charIDToTypeID( \"OpSa\" );
desc7.putEnumerated( id17, id18, id19 );
var id20 = charIDToTypeID( \"Fmt \" );
var id21 = charIDToTypeID( \"IRFm\" );
var id22 = charIDToTypeID( \"JPEG\" );
desc7.putEnumerated( id20, id21, id22 );
var id23 = charIDToTypeID( \"Intr\" );
desc7.putBoolean( id23, false );
var id24 = charIDToTypeID( \"Qlty\" );
desc7.putInteger( id24, 60 );
var id25 = charIDToTypeID( \"QChS\" );
desc7.putInteger( id25, 0 );
var id26 = charIDToTypeID( \"QCUI\" );
desc7.putInteger( id26, 0 );
var id27 = charIDToTypeID( \"QChT\" );
desc7.putBoolean( id27, false );
var id28 = charIDToTypeID( \"QChV\" );
desc7.putBoolean( id28, false );
var id29 = charIDToTypeID( \"Optm\" );
desc7.putBoolean( id29, true );
var id30 = charIDToTypeID( \"Pass\" );
desc7.putInteger( id30, 1 );
var id31 = charIDToTypeID( \"blur\" );
desc7.putDouble( id31, 0.000000 );
var id32 = charIDToTypeID( \"EICC\" );
desc7.putBoolean( id32, false );
var id33 = charIDToTypeID( \"Mtt \" );
desc7.putBoolean( id33, true );
var id34 = charIDToTypeID( \"MttR\" );
desc7.putInteger( id34, 255 );
var id35 = charIDToTypeID( \"MttG\" );
desc7.putInteger( id35, 255 );
var id36 = charIDToTypeID( \"MttB\" );
desc7.putInteger( id36, 255 );
var id37 = charIDToTypeID( \"SHTM\" );
desc7.putBoolean( id37, false );
var id38 = charIDToTypeID( \"SImg\" );
desc7.putBoolean( id38, true );
var id39 = charIDToTypeID( \"SSSO\" );
desc7.putBoolean( id39, false );
var id40 = charIDToTypeID( \"SSLt\" );
var list1 = new ActionList();
desc7.putList( id40, list1 );
var id41 = charIDToTypeID( \"DIDr\" );
desc7.putBoolean( id41, false );
var id42 = charIDToTypeID( \"In \" );
desc7.putPath( id42, new File( \"" & FilePath & theFileName &
".jpg" & "\" ) );
var id43 = stringIDToTypeID( \"SaveForWeb\" );
desc6.putObject( id16, id43, desc7 );
executeAction( id15, desc6, DialogModes.NO );}"
tell application "Adobe Photoshop 7.0"
activate
do javascript theJavascript
end tell
-------------------------
Hope that helps,
Ron Bishop
www.daddydoodaa.com
On Tuesday, July 30, 2002, at 10:44 PM, Jeff Miller wrote:
Hi Ron and Landis,
This seems like a real dumb question. Is there a way to provide the
file name that the Save for Web javascript saves to?
Seems to me like an attribute Photoshop would have provided an action
that saves to a file. But, I can't figure it out.
Thanks for you help,
Jeff
On Thursday, July 11, 2002, at 10:21 AM, Ron Bishop wrote:
I'm so happy that Photoshop finally decided to offer AppleScript
support. Now if only a little helpful documentation and few more
syntax examples were available...
I have a need to automate the "Save for Web" function. If I take a
PICT and do a "Save As" a JPEG with compression 7 (on a scale of
1-12) I get a file that's about 92k in size. If I do a "Save for
Web" with a compression of 60% (about 7/12) my file is 24k and very
similar in quality. Obviously I would prefer the smaller JPEG (I'm
guessing it's saved w/o a resource fork?).
I can't find a "Save for Web" in the Photoshop dictionary. The Save
options for JPEG don't seem to mention WWWReady like Graphic
Converter. Is this possible with Photoshop?
Thanks,
Landis
Landis -
I gotta admit this may be a lazy way, but I simply use the Script
Listener plugin to record the
action in Javascript and use the "do javascript" command. Here is what
i quickly came up with
using "Save for Web" then setting the image to JPEG and 60%. Then I
opened the
ScriptingListenerJS.log file from my desktop and copy and pasted to a
new BBEDIT document.
Here a ran a Search and Replace to (""" to "\"") to care of the
quotes. Then I created a script in
Script Debugger and pasted in the guts.
(All this would probably make a pretty good script...:)
You can see about third of the way down ("desc3.putInteger( id12,
60 );") is where the 60% is
inserted so you could put a variable in there.
Near the bottom is where I Photoshop to save it to my desktop so you
could have a variable
there also.
Multiple images? Put it all into a loop...etc...etc..
tell application "Adobe Photoshop 7.0"
activate
do javascript "{var id3 = charIDToTypeID( \"Expr\" );
var desc2 = new ActionDescriptor();
var id4 = charIDToTypeID( \"Usng\" );
var desc3 = new ActionDescriptor();
var id5 = charIDToTypeID( \"Op \" );
var id6 = charIDToTypeID( \"SWOp\" );
var id7 = charIDToTypeID( \"OpSa\" );
desc3.putEnumerated( id5, id6, id7 );
var id8 = charIDToTypeID( \"Fmt \" );
var id9 = charIDToTypeID( \"IRFm\" );
var id10 = charIDToTypeID( \"JPEG\" );
desc3.putEnumerated( id8, id9, id10 );
var id11 = charIDToTypeID( \"Intr\" );
desc3.putBoolean( id11, false );
var id12 = charIDToTypeID( \"Qlty\" );
desc3.putInteger( id12, 60 );
var id13 = charIDToTypeID( \"QChS\" );
desc3.putInteger( id13, 0 );
var id14 = charIDToTypeID( \"QCUI\" );
desc3.putInteger( id14, 0 );
var id15 = charIDToTypeID( \"QChT\" );
desc3.putBoolean( id15, false );
var id16 = charIDToTypeID( \"QChV\" );
desc3.putBoolean( id16, false );
var id17 = charIDToTypeID( \"Optm\" );
desc3.putBoolean( id17, true );
var id18 = charIDToTypeID( \"Pass\" );
desc3.putInteger( id18, 1 );
var id19 = charIDToTypeID( \"blur\" );
desc3.putDouble( id19, 0.000000 );
var id20 = charIDToTypeID( \"EICC\" );
desc3.putBoolean( id20, false );
var id21 = charIDToTypeID( \"Mtt \" );
desc3.putBoolean( id21, true );
var id22 = charIDToTypeID( \"MttR\" );
desc3.putInteger( id22, 255 );
var id23 = charIDToTypeID( \"MttG\" );
desc3.putInteger( id23, 255 );
var id24 = charIDToTypeID( \"MttB\" );
desc3.putInteger( id24, 255 );
var id25 = charIDToTypeID( \"SHTM\" );
desc3.putBoolean( id25, false );
var id26 = charIDToTypeID( \"SImg\" );
desc3.putBoolean( id26, true );
var id27 = charIDToTypeID( \"SSSO\" );
desc3.putBoolean( id27, false );
var id28 = charIDToTypeID( \"SSLt\" );
var list1 = new ActionList();
desc3.putList( id28, list1 );
var id29 = charIDToTypeID( \"DIDr\" );
desc3.putBoolean( id29, true );
var id30 = charIDToTypeID( \"In \" );
desc3.putPath( id30, new File( \"Macintosh
HardDrive:Users:krbishop:Desktop:\" ) );
var id31 = stringIDToTypeID( \"SaveForWeb\" );
desc2.putObject( id4, id31, desc3 );
executeAction( id3, desc2, DialogModes.NO );}"
end tell
Good luck,
Ron Bishop
www.daddydoodaa.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.