0 Replies - 3779 Views - Last Post: 02 June 2012 - 03:21 AM Rate Topic: -----

#1 Nazkav  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 14-February 09

AppleScript and Photoshop

Posted 02 June 2012 - 03:21 AM

Hello,
this is an AppleScript question and I'm hoping someone can answer as I didn't see any subforums for it on the site.
Basically I am trying to write a script that will work in conjunction with photoshop for work. The purpose of the script is
to open up multiple files in photoshop off of a server using an applescript droplet. The files will all have different names and be in different locations
on said server. Photoshop must then crop the files to three different pixel sizes and save them back on the server in specified folders, then Photoshop must covert original opened files to CMYK and save a jpeg and a tiff in another folder on the server. Also the files will be named "filename_rgb.jpg" and I want the CMYK files to be named "filename_cmyk.jpg" and "filename_cmyk.tif" here is my code so far:
on open myFiles
	tell application "Adobe Photoshop CS4"
		activate
		set myFiles to alias "Macintosh HD:Users:tomfinnane:Desktop:structure:2000x2000:Kav.jpg"
		open myFiles as JPEG
		set ruler units of settings to pixel units
		set theDocument to current document
		tell theDocument
			resize image width 468 height 468 resolution 300 resample method bicubic
		end tell
		save theDocument in file "Macintosh HD:Users:tomfinnane:Desktop:structure:492x492" as JPEG with options {class:JPEG save options, embed color profile:false, quality:12}
		close theDocument
		set myFiles to alias "Macintosh HD:Users:tomfinnane:Desktop:structure:2000x2000:Kav.jpg"
		open myFiles as JPEG
		set ruler units of settings to pixel units
		set theDocument to current document
		tell theDocument
			resize image width 200 height 200 resolution 300 resample method bicubic
		end tell
		save theDocument in file "Macintosh HD:Users:tomfinnane:Desktop:structure:200x200" as JPEG with options {class:JPEG save options, embed color profile:false, quality:12}
		close theDocument
		set myFiles to alias "Macintosh HD:Users:tomfinnane:Desktop:structure:2000x2000:Kav.jpg"
		open myFiles as JPEG
		set ruler units of settings to pixel units
		set theDocument to current document
		tell theDocument
			resize image width 95 height 95 resolution 300 resample method bicubic
		end tell
		save theDocument in file "Macintosh HD:Users:tomfinnane:Desktop:structure:95x95" as JPEG with options {class:JPEG save options, embed color profile:false, quality:12}
		close theDocument
		set myFiles to alias "Macintosh HD:Users:tomfinnane:Desktop:structure:2000x2000:Kav.jpg"
		open myFiles as JPEG
		tell theDocument
			convert to profile "Working CMYK" intent relative colorimetric with blackpoint compensation and dithering
		end tell
		save theDocument in file "Macintosh HD:Users:tomfinnane:Desktop:structure:CMYK" as JPEG with options {class:JPEG save options, embed color profile:false, quality:12}
		close theDocument
		set myFiles to alias "Macintosh HD:Users:tomfinnane:Desktop:structure:2000x2000:Kav.jpg"
		open myFiles as JPEG
		tell theDocument
			convert to profile "Working CMYK" intent relative colorimetric with blackpoint compensation and dithering
		end tell
		set theName to name of current document
		save theDocument in file "Macintosh HD:Users:tomfinnane:Desktop:structure:CMYK" as TIFF with options {class:TIFF save options, embed color profile:false}
          close theDocument
	end tell
end open

I have managed to get photoshop to open the files and perform the actions required but when I try to save the last tiff I get an error "file/folder expected" also I can't get the naming portion correct. Also I foresee problems opening multiple files off of a different location. I have set this script up to work on my laptop at home but it must be portable and work from multiple Mac's all connected to the same file server. I am a Creative Photoshop retoucher with an interest in scripting and programming that is why this problem has landed at my door. I am sorry for the length of this question and the fact that the script is so far from complete but I have no prior knowledge of Applescript and accepted this challenge as my boss asked me personally.

I hope there's someone out there who can help

Thanks

nazkav

Is This A Good Question/Topic? 0
  • +

Page 1 of 1