Photoshop Save as EPS plus text

I took a look at the code, it looks like you need to put your script lines in the ProcessThisFile handler and remove the loop function from it, something like this:

on ProcessThisFile(theFile)
	tell application "Adobe Photoshop CS2"
		with timeout of 300 seconds
			activate
			set display dialogs to never
			set UserPrefs to properties of settings
			set ruler units of settings to pixel units
			open alias theFile
			tell current document
				if (mode is not RGB) then change mode to RGB
				if (bits per channel is sixteen) then set bits per channel to eight
				resize image resolution 72 resample method bicubic
				set docName to name
				set newFileName to (destination_folder as string) & docName & ".lay"
				save in file newFileName as Photoshop EPS appending no extension with options {class:EPS save options, embed color profile:false, encoding:medium quality JPEG, preview type:eight bit TIFF}
				close without saving
			end tell
		end timeout
		tell application "Finder" to move alias theFile to destination_folder
		set ruler units of settings to ruler units of UserPrefs
	end tell
end ProcessThisFile

I don’t have time to test this so there may be errors in it that need to be weeded out.

Okay Jerome so far so good, I’ve got it running.
The only thing I need to change is the path to the destination_folder.
The script doesn’t like the files to be saved in a subfolder.
Having a destination_folder outside the process folder is not a problem
What is the right syntax for this path thing
The path on the machine is “Volumes:XServe1_HD3:DTP:LAY:OUT”
(The process folder is “Volumes:XServe1_HD3:DTP:LAY:IN”)

Thanks for all the help so far!!

The easiest thing to do would be to hard code it in the script. You are setting it up on a specific computer so it should always be there when you are running it.

set destination_folder to alias "Volumes:XServe1_HD3:DTP:LAY:OUT"

In the folder action that you were working on that would replace:

   tell application "Finder"
       if not (exists folder "Done" of this_folder) then
           make new folder at this_folder with properties {name:"Done"}
       end if
       set the destination_folder to folder "Done" of this_folder as alias
   end tell

You could add back in some error checking features to ensure that the folder exists, I think that should be something like this:

   tell application "Finder"
       if not (exists folder "OUT" of alias "Volumes:XServe1_HD3:DTP:") then
           make new folder at alias "Volumes:XServe1_HD3:DTP:" with properties {name:"OUT"}
       end if
       set the destination_folder to folder "OUT" of alias "Volumes:XServe1_HD3:DTP:" as alias
   end tell

Hi Jerome thanks for the reply but I already solved it


property debugMe : true
property delayTime : 2
property fileNameList : {}
property fileSizeList : {}
property fileProcessedList : {}
property folderToProcess : missing value
--property folderToProcess : "Volumes:XServe1_HD3:DTP:LAY:"

property main_folder : "Volumes:XServe1_HD3:DTP:"


on run
	
	set folderToProcess to choose folder with prompt "Select Folder to process files"
	set {fileNameList, fileSizeList, fileProcessedList} to {{}, {}, {}}
end run

on idle
	try
		my dd("Checking for differences in "" & (folderToProcess as Unicode text) & ""...")
		set startTime to current date
		set {newNameList, newSizeList} to my CreateFileNameSizeLists(folderToProcess)
		set {filesToProcess, newNewNameList, newNewSizeList} to {{}, {}, {}}
		repeat with j from 1 to (count newNameList)
			set {addedToListToBeProcessed, newName, newSize} to {false, newNameList's item j, newSizeList's item j}
			repeat with i from 1 to (count fileNameList)
				set {fileName, fileSize} to {fileNameList's item i, fileSizeList's item i}
				if fileName = newName then
					if newSize is not 0 and newSize = fileSize then
						my dd("Adding "" & fileName & "" to list of files to be processed...")
						set {addedToListToBeProcessed, filesToProcess's end} to {true, fileName}
						exit repeat
					end if
				end if
			end repeat
			if not addedToListToBeProcessed then
				if fileProcessedList does not contain newName then
					--my dd("Adding "" & (folderToProcess as Unicode text) & newName & "" to new file lists...") 
					set {newNewNameList's end, newNewSizeList's end} to {newName, (info for (((folderToProcess as Unicode text) & newName) as alias))'s size}
				end if
			end if
		end repeat
		set {fileNameList, fileSizeList} to {newNewNameList, newNewSizeList}
		repeat with i from 1 to (count filesToProcess)
			set fileProcessedList's end to filesToProcess's item i
		end repeat
		my ProcessFiles(filesToProcess)
		set diffTime to ((current date) - startTime)
		if (diffTime is greater than or equal to delayTime) then
			return 1
		else
			return delayTime - diffTime
		end if
	on error e
		my dd("Error: " & e)
		--set the clipboard to e 
	end try
end idle

on ProcessFiles(theFiles)
	repeat with i from 1 to (count theFiles)
		my dd("Processing "" & ((folderToProcess as Unicode text) & theFiles's item i) & ""...")
		my ProcessThisFile(((folderToProcess as Unicode text) & theFiles's item i) as alias)
	end repeat
	if theFiles is not {} then my dd("Number of processed items: " & (count theFiles))
end ProcessFiles

on ProcessThisFile(theFile)
	tell application "Finder"
		if not (exists folder "LAY_OUT" of folder main_folder) then
			make new folder at main_folder with properties {name:"LAY_OUT"}
		end if
		set the destination_folder to folder "Volumes:XServe1_HD3:DTP:LAY_OUT" as alias
	end tell
	set process_count to 0
	tell application "Adobe Photoshop CS2"
		with timeout of 120 seconds
			activate
			set display dialogs to never
			set UserPrefs to properties of settings
			set ruler units of settings to pixel units
			open theFile
			tell current document
				if (mode is not RGB) then change mode to RGB
				if (bits per channel is sixteen) then set bits per channel to eight
				resize image resolution 150 resample method bicubic
				set docName to name
				set newFileName to (destination_folder as string) & docName & ".lay"
				save in file newFileName as Photoshop EPS appending no extension with options {class:EPS save options, embed color profile:false, encoding:medium quality JPEG, preview type:eight bit TIFF}
				close without saving
				tell application "Finder" to move theFile to destination_folder with replacing
			end tell
			tell application "Adobe Photoshop CS2"
				set ruler units of settings to ruler units of UserPrefs
			end tell
		end timeout
	end tell
end ProcessThisFile

on CreateFileNameSizeLists(theFolder)
	set folderList to list folder theFolder without invisibles
	set {myNameList, mySizeList} to {{}, {}}
	repeat with j from 1 to (count folderList)
		if (folderList's item j)'s character 1 is not "." then
			set theInfo to info for ((theFolder as Unicode text) & (folderList's item j) as alias)
			-- if (theInfo's folder) then (*perhaps we want to copy folders *) 
			set {myNameList's end, mySizeList's end} to {theInfo's name, theInfo's size}
			-- end if 
		end if
	end repeat
	return {myNameList, mySizeList}
end CreateFileNameSizeLists

on dd(m)
	if m starts with "Error:" then
		activate
		beep 2
		if (display dialog m buttons {"Quit", "OK"} default button 2 with icon 0)'s button returned = "Quit" then quit
	else if debugMe then
		activate
		if (display dialog m buttons {"Quit", "OK"} default button 2 with icon 1 giving up after 1)'s button returned = "Quit" then quit
	end if
end dd