Photoshop script works in Leopard, not in Tiger

howdy all,

i wrote this script in Leopard, but i didn’t think i was using any language that wasn’t already established in Tiger, but it’s not working in Tiger for some reason and i can’t find any reference for anything different. it seems to break at the line “set cpPath to the entire path of every path item of current document”

can someone tell me what i’m doing wrong?
thanks!
ray


property type_list : {"TIFF", "JPEG"}
property extension_list : {"tif", "jpg"}


on run
	
	-- save old TID
	set oldDelims to AppleScript's text item delimiters
	
	-- declare new TID
	set AppleScript's text item delimiters to "."
	
	
	tell application "Finder"
		
		--find the content folders
		set jpeg_folder to (choose folder with prompt "Choose the folder containing the JPEG images:") as string
		set jpeg_files to every file of folder jpeg_folder whose ¬
			file type is in the type_list and name extension is in the extension_list
		
		set tiff_folder to (choose folder with prompt "Choose the folder containing the tiff images:") as string
		set tiff_files to every file of folder tiff_folder whose ¬
			file type is in the type_list and name extension is in the extension_list
		
		set end_folder to (choose folder with prompt "Choose a destination folder for your new images:") as string
		
		
		--start the process
		try
			
			--work from the jpeg files
			repeat with jpeg_files in the jpeg_files
				
				--strip the file name of the suffix
				set {name:n} to properties of jpeg_files
				set fName to n's text 1 thru text item -2
				
				--find the files with the same name
				set cpJpeg to jpeg_folder & fName & ".jpg"
				set hiresTiff to tiff_folder & fName & ".tif"
				
				
				--open JPEG
				tell application "Adobe Photoshop CS3"
					activate
					open file cpJpeg
					
					--get the paths
					set cpPath to the entire path of every path item of current document
					set cpName to the name of every path item of current document
					close current document
				end tell
				
				
				--open TIFF
				if exists hiresTiff then
					tell application "Adobe Photoshop CS3"
						activate
						open file hiresTiff
						
						--add the paths
						repeat with i from 1 to count cpPath
							set newCP to item i of cpPath
							set newName to item i of cpName
							set newpath to make path item of current document with properties {name:newName, entire path:newCP, kind:clipping}
						end repeat
						
						--save new file as tiff in separate folder
						save current document as TIFF in file end_folder without copying
						
						close current document
					end tell
				end if
			end repeat
		end try
		
		--tidy up
		set AppleScript's text item delimiters to oldDelims
		
		
	end tell
end run


I can’t test your script so I’m not sure… but why do you have the tell statements for photoshop inside of tell statements for the finder? Maybe that’s causing a problem???

You can only have 1 clipping path in a photoshop document. So setting the kind to clipping in the loop would result in the last path being set to clipping and each previous path reverting to normal. You should test for the name of the clipping path in you first doc and set accordingly in the second else it works on Tiger with CS2. I does freeze if there are no paths in the jpeg don’t know if you would need that catch though.

bad scripting on my part, and good point… i’ll start there.

…another good point.

i just haven’t gotten as far as building error traps; all the jpegs should have at least one clipping path, but we WOULD need to know if one doesn’t.

thanks guys! i’ll post results from my fixes…

ray

I’m surprised that this works anyway :wink: