Photoshop CS6 problem

Hi all,

this script worked in Photoshop CS5 - now in Photoshop CS6 it returns this error message: “Can’t get current document”

Anyone knows how to adjust the applescript so that it will work in CS6?

tell application "Adobe Photoshop CS5"
	tell current document
		set filePath to "OSX:Users:Tobias:Dropbox:sjungarna:offline:projekt:1:" & "cdask_web_1.png"
		save in file filePath as PNG with options {file type:PNG, png eight:false, transparency:true, with profile:false} appending lowercase extension with copying
	end tell
end tell

could it be that noone knows how to solve this issue?

Hi,

perhaps most people don’t own Ps 6¿ like me :wink:

If your running into problems try to change the code:

tell application "Adobe Photoshop CS3"
	set myFile to (path to home folder as text) & "Dropbox:cdask_web_1.png"
	set myOptions to {file type:PNG, png eight:false, transparency:true, with profile:false}
	save current document in file myFile as PNG with options myOptions appending no extension without copying
end tell

Hope it’ll work :slight_smile:

Hello,
try to use this line:

save in file filePath with options {class:PNG save options, compression:0, interlaced:false} appending lowercase extension with copying

look also in Photoshops Dictionary under “PNG SAVE OPTIONS”. There are only 2 properties called “compression” and “interlaced”.

For web export as PNG look under “SAVE FOR WEB EXPORT OPTIONS” in the dictionary.

Greets from
TMA

I too have this problem and think that there has been a bug introduced in Photoshop CS6.

introducing save or export options show as an error message “Adobe Photoshop CS6 got an error: Can’t get document 1”

tell application "Adobe Photoshop CS6"
	save document 1 in "CS6Test:Users:cs6test:Desktop:pngsave.png" as PNG with copying -- with options {png eight:false, transparency:true, web format:PNG}
	export document 1 in "CS6Test:Users:cs6test:Desktop:pngexport.png" as save for web with save for web export options -- {web format:PNG}
end tell

but without adding options the files do save OK.

Any help much appreciated!

Hi Guys

Try this for the save option:

tell application "Adobe Photoshop CS6"
	set thisDoc to current document
	set thisDocname to name of thisDoc
	tell thisDoc
		set filePath to (path to desktop folder) & thisDocname as text
		set PNGSaveOptions to {class:PNG save options, compression:5, interlaced:true} --these are the only save options for PNG
		save thisDoc in file filePath as PNG with options PNGSaveOptions
	end tell
end tell

Try this for the export option:

tell application "Adobe Photoshop CS6"
	set thisDoc to current document
	set thisDocname to name of thisDoc
	tell thisDoc
		set filePath to (path to desktop folder) & thisDocname & ".png" as text -- create something here to shorten the file name so you don't get 2 extensions
		set PNGExportOptions to {class:save for web export options, quality:5, png eight:false, transparency:true, web format:PNG}
		export thisDoc in filePath as save for web with options PNGExportOptions
	end tell
end tell

add your own little bits on the end regarding extensions,copying etc… but the options i believe are working let me know if these do the trick.

ToBeJazz it looks like your using export options with the save command i’m not sure about previous versions of PS but it looks like you may need to be more explicit in this version.

Hope this helps.

Excellent, that is working thanks, a combination of adding the complete file path rather than just the destination folder and the class:save for web export options does the trick.

To be clear to others looking for this answer the following line that is working fine in Photoshop CS4

export in YourExportLocation as save for web with options {png eight:false, transparency:true, web format:PNG}

needs to be changed to this for Photoshop CS6

export in (YourExportLocation & “:” & YourDocName & “.png”) as save for web with options {class:save for web export options, png eight:false, transparency:true, web format:PNG}

Finally, I’ve tried your solution pidge1, and I can confirm that it works just fine for me as well - thanks a lot!