Error when reaching the save section of script

Hi everyone I am having a little trouble at the tail end of my script here, when it goes to save I get an error "can’t make <>. Any help would be greatly appreciated :slight_smile:


-- Get users input for which folder PS will work from
set tempFolderName to "Temp"
set inputFolder to choose folder

-- Has finder setup a "temp" folder within the chosen directory
tell application "Finder"
	set filesList to files in inputFolder
	if (not (exists folder ((inputFolder as string) & tempFolderName))) then
		set outputFolder to make new folder at inputFolder with properties {name:tempFolderName}
	else
		set outputFolder to folder ((inputFolder as string) & tempFolderName)
	end if
end tell

-- Starts Photoshop CS5 with restrictions
tell application "Adobe Photoshop CS5"
	set display dialogs to never
	close every document saving no
end tell

-- Start of the decision on proper scaling of the images

repeat with aFile in filesList
	
	set fileIndex to 0
	
	tell application "Finder"
		set theFileName to name of aFile
		set theFile to aFile as string
	end tell
	
	tell application "Adobe Photoshop CS5"
		
		open alias theFile
		
		-- Setting Document Variables for width and height		
		set docRef to the current document
		set docHeight to height of docRef
		set docWidth to width of docRef
		
		if (docHeight > docWidth) then
			do action "Tall Edit" from "MMS"
		end if
		if (docHeight < docWidth) then
			do action "Wide Edit" from "MMS"
		end if
		if (docHeight = docWidth) then
			do action "Equal Edit" from "MMS"
		end if
		
		set myFile to outputFolder
		set myOptions to {class:JPEG save options, embed color profile:false, format options:standard, matte:background color matte}
		save current document in file myFile as JPEG with options myOptions appending no extension without copying
	end tell
end repeat

Hi,

the class of outputFolder is a Finder file specifier, which Photoshop doesn’t recognize.
Coerce it to a string path.

PS: I’m not sure whether the folder path is sufficient, maybe you must append the proper file name

Stefan, sorry but I’m a bit new at this whole scripting thing. I’ve only gotten this far in it by doing a lot of searching a putting things together. Could you explain that to me barney big bird style… man i feel dumb right now lol

try it first with


set myFile to outputFolder as text

this coerces the file specifier to a string path

Works perfect! Thank you very very much! Now I understand what you mean to make it a string path, makes sense. Thank you again! :smiley: