My first Photoshop Applescript Not Working

I’ve just started to learn Applescript and wrote the following script to try and get Photoshop to adjust an image (change the canvas size) and save it under a new name in the same directory. However, on running the script it adjusts the image OK but stops at a ‘save as’ screen waiting for the user to click on save (with the file name still the same as the opened file).

I’ve looked up many example ‘save’ scripts on the web and can’t see where I’m going wrong - the save syntax looks identical to mine. Any ideas anyone?

tell application “Adobe Photoshop CS4”
open {file “Jobs:Live:Page2_3.PSD”}
resize canvas of the current document width 40.3 height 30 anchor position middle left
save current document in file “Jobs:Live:webPage.jpg” as JPEG
end tell

I think your are getting a “save as” copy dialog because your PSD file contains elements that are not supported by the JPEG file format you should test your file complies with a file format before trying to save to it. You could have something like layers etc. You could also use the “with copying” option.

tell application "Adobe Photoshop CS4"
	open {file "Jobs:Live:Page2_3.PSD"}
	resize canvas of the current document width 40.3 height 30 anchor position middle left
	save current document in file "Jobs:Live:webPage.jpg" as JPEG with copying
	close current document saving no
end tell

If the file is in a folder “Live” on disk “Jobs” everything is fine :wink:

Thanks guys - I had layers and needed to flatten the image!! I’m learning!!!

Thanks - the file is in a folder “Live” on disk “Jobs”. I should have mentioned that.