Skip to main content
Inspiring
March 24, 2013
Question

cs6 save tiff options with applescript

  • March 24, 2013
  • 2 replies
  • 3351 views

hi all, new to this so be kind!

trying to create a simple script that will do a save as of the current doc in photoshop as an lzw, flat tiff, prompting for the location to save the file to.

this is what i have so far:

set targetFolder to choose folder with prompt ¬

          "Location for exported files"

set targetPath to targetFolder as string

tell application "Adobe Photoshop CS6"

  activate

  save current document in file (targetFolder) as TIFF with options {byte order:Mac OS, embed color profile:false, image compression:LZW, save alpha channels:false, save layers:false} appending lowercase extension with copying

  close current document without saving

end tell

but i keep getting this error:

error "Adobe Photoshop CS6 got an error: Can’t make some data into the expected type." number -1700 to item

ive tried comparing the tiff options code to other sample scripts but it seems to be correct format?


This topic has been closed for replies.

2 replies

Inspiring
March 24, 2013

You are trying to save in an incomplete file path… I only have CS5 but this works just fine here… You will see I concat the variable targetPath with the document name and this provides a full path…

set targetFolder to choose folder with prompt ¬

          "Location for exported files"

set targetPath to targetFolder as string

tell application "Adobe Photoshop CS5"

  activate

  save current document in file (targetPath & name of current document) as TIFF with options {byte order:Mac OS, embed color profile:false, image compression:LZW, save alpha channels:false, save layers:false} appending lowercase extension with copying

  close current document without saving

end tell

kimmo242Author
Inspiring
March 25, 2013

thanks mark, i tried that script and it still has the error as "can't make some data into expected type", highlighting the whole 'save' passage of the code. luckily i have a copy of cs4 still, changed code to suit and tested on that, and just as you say the code works fine on earlier versions, something changed with cs6 perhaps?

this is the error

error "Adobe Photoshop CS6 got an error: Can’t make some data into the expected type." number -1700 to item

thanks again

March 24, 2013
  • The variable targetPath is defined but not used...
  • Using directly targetFolder as the destination folder to save the current document seems to work for me, at least in CS4...

set targetFolder to choose folder with prompt "Location for exported files"

tell application "Adobe Photoshop CS4"

  activate

  save current document in targetFolder as TIFF with options {byte order:Mac OS, embed color profile:false, image compression:LZW, save alpha channels:false, save layers:false} appending lowercase extension with copying

  close current document without saving

end tell

kimmo242Author
Inspiring
March 24, 2013

hi thank you so much!

ive tried your script edit (changed to target photoshop cs6 of course), but now it says 'adobe photoshop cs6 got an error: Can't get current document'

any ideas?

otherwise i can make an action in psd to set tiff preferences, its only one extra 'click' in the process, but if i can get this working was going to make an app for my toolbar

thanks for your help

March 24, 2013

Can't get current document'

any ideas?

Apart from the obvious, i.e.check that there is indeed an open document in the first place, I would suggest trying to replace every occurrence of "current document" with "front document" and see if it gets any better... Good luck!