Scripting Save for Web
Hey guys
I am trying to script for Save for Web with a simple AppleScript that will later be added asa process in a much learger script that takes ai files exported to psd's and takes them into Photoshop to push them out as sRGB png's.
My script is
set targetFolder to (choose file name) as text
set targetPath to targetFolder & "New"
tell application "Adobe Photoshop CC 2017"
tell current document
activate
set theDocument to current document
set exportOptions to POSIX file {class:save for web export options, transparency:true, web format:PNG, matte:true, png eight:false, with profile:true}
export theDocument in file targetPath as save for web with options exportOptions
end tell
end tell
This won't work I get the error "Adobe Photoshop CC 2017 got an error: Can’t get current document of current document." number -1728 from current document of current document
But if I take away export options part it will export with my previous export settings. So i saved my settings as a preset and changed my export options to set exportOptions to POSIX file "/Users/mileskelly/Library/Preferences/Adobe Photoshop CC 2017 Settings/Optimized Settings/JDO_PNG-24 Settings.irs". In the hope that point it to the settings file it would us my setting but I can't get it to work.
Can anyone help me out?
Thanks
Miles K
