I know I can use this
tell application "Finder"
set savefolder to "" & (path to current user folder) & "Desktop:"
end tell
tell application "Adobe Photoshop CS5"
activate
set theName to name of document 1
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
set theName to text item 1 of theName
set AppleScript's text item delimiters to tid
export document 1 in ("" & savefolder & theName & ".png") as save for web with options {web format:PNG, transparency:false}
end tell
to export the current document on Photoshop, to PNG without transparency, but how do I do that with a specific size?
How do I do that? thanks.
The problem is that I have to export the current document as PNG to several different sizes each time, for example, 100x100 pixels, 200x200 pixels, etc., and I would like to automate that.
Hi,
first of all, your script can be simplified to
set savefolder to path to desktop as text
tell application "Adobe Photoshop CS5"
export document 1 in savefolder as save for web with options {web format:PNG, transparency:false}
end tell
Photoshop changes the file extension automatically.
To save a document with different sizes you have to resize the image.
Photoshop can save several history states, so the size of the original image will be restored after each resizing process.
The new file includes also the value of the new size.
The image will be resized based on the value of the larger side
tell application "Adobe Photoshop CS5"
set currentDoc to the current document
end tell
resizeExportDoc(currentDoc, 200)
resizeExportDoc(currentDoc, 400)
on resizeExportDoc(doc, newSize)
set exportFolder to path to desktop as text
tell application "Adobe Photoshop CS5"
tell doc
set pixelHeight to height
set pixelWidth to width
set baseName to text 1 thru -5 of (get its name)
set pngName to baseName & "_" & newSize & ".png"
set currentHistoryState to current history state
if pixelHeight > pixelWidth then
resize image height newSize
else
resize image width newSize
end if
export it in (exportFolder & pngName) as save for web with options {web format:PNG, transparency:false}
set current history state to currentHistoryState
end tell
end tell
end resizeExportDoc
I have only CS3, I hope it works also in CS5
simply P E R F E C T ! ! ! ! !
THANKS!! 
I have installed Photoshop CS6 today and now the line
export it in (exportFolder & pngName) as save for web with options {web format:PNG, transparency:false}
that I had changed slightly to
export doc in (myFileName) as save for web with options {web format:PNG, transparency:true, png eight:false, interlaced:false, dither:none, quality:100}
before and was working on CS5, is not working in CS6. And the bad part is that even if I try it on CS5 it will not run anymore…
This is the error I get:
error “Adobe Photoshop CS6 got an error: Can’t get document "xxx".” number -1728 from document “xxx”
xxx is the document name.

myFileName must be a full path, not a file name
it is. It is created like this
sett exportFolder to (path to desktop as text) & "icones:"
set myFileName to exportFolder & "icon.png"
It would help if Applescript error messages were more clear…
They are. I just noticed that you changed export it to export doc.
This causes a double referencing which also tells us the error message
error "Adobe Photoshop CS6 got an error: Can’t get document . from document .
hi, thanks for your answer, but changing it to “it” do not solves the problem.
I have run into this with CS6 as well, if you want to revert back to CS5 with the script, simply rename “Adobe Photoshop CS6” to “Adobe Photoshop” throughout the script and the next time you run it AppleScript Editor will ask you which version of the app you would like to use.
I am starting to think this is just a bug with the export command and CS6? Very frustrating and unable to find a work around so far.