Photoshop CS2 action runner not right

This script is designed to process images using photoshop according to prebuilt actions. it all works fine untill I try and call the subroutine from a choose from list if statement. Please help :smiley:

set FilesList to choose file with multiple selections allowed

set chooseIt to choose from list {"CMYK7col", "naaa"}
if chooseIt is "CMYK7col" then
	my ColourModeResize("CMYK7col", FilesList)
end if

on ColourModeResize(ModeAndSize, FilesList)
	tell application "Adobe Photoshop CS2"
		activate
		repeat with i from 1 to number of items in FilesList
			set tempfile to item i of FilesList as alias
			open tempfile
			do action ModeAndSize from "Scanning Actions.atn"
		end repeat
	end tell
end ColourModeResize

I realize this won’t work straight out of script editor as you won’t have the presets in CS2 I have.

But if I use it as a string it wont be able to loop through using items from the list will it? I need multiple items to choose from and that doesn’t appear to work. It works for the first item but not for any following. This is my complete script:

set FilesList to choose file with multiple selections allowed

set colourMode to display dialog "Colour or Mono?" buttons {"Cancel", "Mono", "Colour"} default button "Colour"
if button returned of colourMode is "Cancel" then
	--do nothing
else if button returned of colourMode is "Mono" then
	set MonoSizeList to choose from list sizeList with prompt "Choose a column size"
	
	if MonoSizeList is "1" then
		my ColourModeResize("Mono1col", FilesList)
		
	else if MonoSizeList is "2" then
		my ColourModeResize("Mono2col", FilesList)
		
	else if MonoSizeList is "3" then
		my ColourModeResize("Mono3col", FilesList)
		
	else if MonoSizeList is "4" then
		my ColourModeResize("Mono4col", FilesList)
		
	else if MonoSizeList is "5" then
		my ColourModeResize("Mono5col", FilesList)
		
	else if MonoSizeList is "6" then
		my ColourModeResize("Mono6col", FilesList)
		
	else if MonoSizeList is "7" then
		my ColourModeResize("Mono7col", FilesList)
	end if
	
else if button returned of colourMode is "Colour" then
	set ColourSizeList to choose from list sizeList with prompt "Choose a column size"
	
	if ColourSizeList is "1" then
		my ColourModeResize("CMYK1col", FilesList)
		
	else if ColourSizeList is "2" then
		my ColourModeResize("CMYK2col", FilesList)
		
	else if ColourSizeList is "3" then
		my ColourModeResize("CMYK3col", FilesList)
		
	else if ColourSizeList is "4" then
		my ColourModeResize("CMYK4col", FilesList)
		
	else if ColourSizeList is "5" then
		my ColourModeResize("CMYK5col", FilesList)
		
	else if ColourSizeList is "6" then
		my ColourModeResize("CMYK6col", FilesList)
		
	else if ColourSizeList is "7" then
		my ColourModeResize("CMYK7col", FilesList)
	end if
end if

on ColourModeResize(ModeAndSize, FilesList)
	tell application "Adobe Photoshop CS2"
		activate
		repeat with i from 1 to number of items in FilesList
			set tempfile to item i of FilesList as alias
			open tempfile
			do action ModeAndSize from "Scanning Actions.atn"
		end repeat
	end tell
end ColourModeResize

Thanks for the suggestions. Any other ideas?

Thanks that worked fine. Sorry I didn’t understand what you were getting at the first time.
:smiley:

You could also do something like this, Chuckles:

on ColourModeResize(ModeAndSize, FilesList) (* handler untested *)
	tell application "Adobe Photoshop CS2" to repeat with f in FilesList
		open f
		do action ModeAndSize from "Scanning Actions.atn"
	end repeat
end ColourModeResize

set FilesList to choose file with multiple selections allowed
set colourMode to button returned of (display dialog "Colour or Mono?" buttons {"Cancel", "Mono", "Colour"} default button 3)
set colSize to choose from list {1, 2, 3, 4, 5, 6, 7} with prompt "Choose a column size"
activate application "Adobe Photoshop CS2"
ColourModeResize(colourMode & colSize & "col", FilesList)