Script no longer works in Photoshop CS 6

This script worked great until I upgraded to Photoshop CS 6. I am sure I am missing something simple. The error I get is ‘File some object wasn’t found’.

The script does create the ‘Done’ folder on the Desktop, and launches Photoshop.

Any help would be greatly appreciated.



-- This droplet processes both files or folders of files dropped onto the applet
on open these_items
	repeat with i from 1 to the count of these_items
		set this_item to (item i of these_items)
		set the item_info to info for this_item
		if folder of the item_info is true then
			process_folder(this_item)
		else if (alias of the item_info is false) then
			my process_item(this_item)
		end if
	end repeat
	tell application "Finder"
		activate
	end tell
	beep 2
end open

-- this sub-routine processes folders
on process_folder(this_folder)
	set these_items to list folder this_folder without invisibles
	repeat with i from 1 to the count of these_items
		set this_item to alias ((this_folder as text) & (item i of these_items))
		set the item_info to info for this_item
		if folder of the item_info is true then
			process_folder(this_item)
		else if (alias of the item_info is false) then
			my process_item(this_item)
		end if
	end repeat
end process_folder

on process_item(this_item)
	set PathToDesktop to path to the desktop as text
	tell application "Finder"
		activate
		if exists folder "DONE" then
		else
			make new folder at desktop with properties {name:"DONE"}
		end if
	end tell
	
	tell application "Adobe Photoshop CS6"
		activate
		delay 2
		set ruler units of settings to pixel units
		open this_item
		set AppleScript's text item delimiters to {":"}
		set TempFileName to last text item of (this_item as string)
		set AppleScript's text item delimiters to {"."}
		set FinalFileName to first text item of (TempFileName as string)
		
		if width of current document is greater than 400 then
			resize image current document width 400 resolution 72 resample method bicubic
			
			change mode of current document to RGB
			
			export current document in file (PathToDesktop & ":DONE:" & FinalFileName & ".jpg") as save for web with options {web format:JPEG, quality:50, optimized size:true, with profile:false}
			close current document saving no
			
		else if height of current document is greater than 600 then
			resize image current document height 600 resolution 72 resample method bicubic
			
			change mode of current document to RGB
			
			export current document in file (PathToDesktop & ":DONE:" & FinalFileName & ".jpg") as save for web with options {web format:JPEG, quality:50, optimized size:true, with profile:false}
			close current document saving no
			
		else if width of current document is less than 400 then
			resize image current document resolution 72 resample method bicubic
			
			change mode of current document to RGB
			
			export current document in file (PathToDesktop & ":DONE:" & FinalFileName & ".jpg") as save for web with options {web format:JPEG, quality:50, optimized size:true, with profile:false}
			close current document saving no
			
			
		end if
		
		set ruler units of settings to inch units
	end tell
	
end process_item


Model: MacBook Pro
AppleScript: 2.2.3
Browser: Firefox 18.0
Operating System: Mac OS X (10.8)

What changed to break your script.? I’ve seen several posts that say PS CS5 & CS6 don’t like AppleScript’s alias any more and that passing a string to open is fine. I didn’t test your code but jump past CS5.? Only I would have expected you to have already have this issue before now. Sorry but I don’t have CS6

I jumped a little further than that…CS 3 to CS 6

For anyone interested, I have found the problem. Here is the finished working script.


--Edited to work for Photoshop CS 6


-- This droplet processes both files or folders of files dropped onto the applet
on open these_items
	repeat with i from 1 to the count of these_items
		set this_item to (item i of these_items)
		set the item_info to info for this_item
		if folder of the item_info is true then
			process_folder(this_item)
		else if (alias of the item_info is false) then
			my process_item(this_item)
		end if
	end repeat
	tell application "Finder"
		activate
	end tell
	beep 2
end open

-- this sub-routine processes folders
on process_folder(this_folder)
	set these_items to list folder this_folder without invisibles
	repeat with i from 1 to the count of these_items
		set this_item to alias ((this_folder as text) & (item i of these_items))
		set the item_info to info for this_item
		if folder of the item_info is true then
			process_folder(this_item)
		else if (alias of the item_info is false) then
			my process_item(this_item)
		end if
	end repeat
end process_folder

on process_item(this_item)
	set PathToDesktop to path to the desktop as text
	tell application "Finder"
		activate
		if exists folder "DONE" then
		else
			make new folder at desktop with properties {name:"DONE"}
		end if
	end tell
	
	--This line needed for CS 6
	
	set this_item to this_item as string
	
	tell application "Adobe Photoshop CS6"
		activate
		delay 2
		
		set ruler units of settings to pixel units
		
		--The word 'file' is needed in CS 6
		
		open file this_item showing dialogs never
		
		
		set AppleScript's text item delimiters to {":"}
		set TempFileName to last text item of (this_item as string)
		set AppleScript's text item delimiters to {"."}
		set FinalFileName to first text item of (TempFileName as string)
		
		-- The word EXPORT needed to be added for CS 6
		
		if width of current document is greater than 400 then
			resize image current document width 400 resolution 72 resample method bicubic
			
			change mode of current document to RGB
			
			(export current document in file (PathToDesktop & ":DONE:" & FinalFileName & ".jpg") as save for web) export with options {web format:JPEG, quality:50, optimized size:true, with profile:false}
			close current document saving no
			
		else if height of current document is greater than 600 then
			resize image current document height 600 resolution 72 resample method bicubic
			
			change mode of current document to RGB
			
			(export current document in file (PathToDesktop & ":DONE:" & FinalFileName & ".jpg") as save for web) export with options {web format:JPEG, quality:50, optimized size:true, with profile:false}
			close current document saving no
			
		else if width of current document is less than 400 then
			resize image current document resolution 72 resample method bicubic
			
			change mode of current document to RGB
			
			(export current document in file (PathToDesktop & ":DONE:" & FinalFileName & ".jpg") as save for web) export with options {web format:JPEG, quality:50, optimized size:true, with profile:false}
			close current document saving no
			
			
		end if
		
		set ruler units of settings to inch units
	end tell
	
end process_item


Changes for CS 6 are documented in the code.