Drag-and-drop functonality?

In trying to make a script into a drag-and-drop, this now errors out telling me it can’t create a folder (“Can’t make class «class cfol». Finder got an error: Can’t make class folder. (-2710”)". I’m not sure what it is I’m missing, but would appreciate any pointers.

on open sortzipPrep
tell application "Finder"
	
	tell application "Finder"
		set inputFolder to choose folder default location sortzipPrep with prompt "Select font folder to be zipped"
		tell current application
			set qpp to quoted form of POSIX path of inputFolder
			do shell script "cd $(dirname " & qpp & ")
			zip -r  \"$(basename " & "_TYPEFACES" & ").zip\" \"$(basename " & qpp & ")\""
		end tell
		delete inputFolder
	end tell
	
	--create new hires folder
	make new folder at sortzipPrep with properties {name:"HIRES"}
	--set path to move to HIRES folder
	set hiFiles to (sortzipPrep as string) & "HIRES"
	
	-- move files to HIRES
	set targetFiles to get every item of (entire contents of sortzipPrep) whose kind ≠ "Folder"
	--set targetFolder to hiFiles
	move targetFiles to hiFiles
	delete (every folder of sortzipPrep whose name is not "HIRES")
	make new folder at sortzipPrep with properties {name:"PREVIEWS"}
	
	--notify completion
	display notification "FONTS ZIPPED AND FILES SORTED"
	
end tell
end open

I noticed you have a “Tell Finder” block inside a “Tell Finder” block.
I’m more partial to “System Events” for file manipulation
–edit-- I put it back to “Finder” to get it to work

here is my modified version.
I didn’t test it since I don’t have the file to test on.

Let me know if it works?

on open sortzipPrep
	local targetFiles
	set sortzipPrep to item 1 of sortzipPrep -- "on open creates a list of disk items"
	set inputFolder to (choose folder default location sortzipPrep with prompt "Select font folder to be zipped")
	
	set qpp to quoted form of POSIX path of inputFolder
	do shell script "cd $(dirname " & qpp & ") zip -r  \"$(basename " & "_TYPEFACES" & ").zip\" \"$(basename " & qpp & ")\""
	
	tell application "Finder"
		make new folder at (sortzipPrep as text) with properties {name:"HIRES"}
		make new folder at (sortzipPrep as text) with properties {name:"PREVIEWS"}
		delete folder inputFolder
		--create new hires folder
		
		--set path to move to HIRES folder
		set hiFiles to (sortzipPrep as string) & "HIRES"
		
		-- move files to HIRES
		set targetFiles to get every item of (entire contents of folder sortzipPrep) whose kind ≠ "Folder"
		--set targetFolder to hiFiles
		move targetFiles to hiFiles
		delete (every folder of sortzipPrep whose name is not "HIRES")
		
		--notify completion
		display notification "FONTS ZIPPED AND FILES SORTED"
		
	end tell
end open

Oops. didn’t see my double finder there, thanks!

Unfortunately I get an error telling me that it can’t make alias out of the font folder (error -1700).

The direct parameter of the on open handler is always a list. You need to dereference it or iterate through it.

I edited my original post above!

It works for me now.

Still getting an error “…into type location specifier. (-1700)”. Not sure why.

EDIT: This is after I try to drag-and-drop a folder onto app

Sorry, My bad. I re-edited it.
I forgot to change “System Events” back to “Finder”

Try it now.

Who~oops. I just caught something. It’s not zipping the font folder, instead it’s deleting it without zipping it beforehand.

Sussed it out!

on open sortzipPrep
	local sortzipPrep
	set sortzipPrep to item 1 of sortzipPrep -- "on open creates a list of disk items"
	
	tell application "Finder"
		--pick and zip font folder
		set inputFolder to (choose folder default location sortzipPrep with prompt "Select font folder to be zipped")
		set qpp to quoted form of POSIX path of inputFolder
		do shell script "cd $(dirname " & qpp & ")
		zip -r  \"$(basename " & "_TYPEFACES" & ").zip\" \"$(basename " & qpp & ")\""
		delete folder inputFolder
		--create new hires folder
		make new folder at (sortzipPrep as text) with properties {name:"HIRES"}
		
		--set path to move to HIRES folder
		set hiFiles to (sortzipPrep as string) & "HIRES"
		
		-- move files to HIRES
		set targetFiles to get every item of (entire contents of folder sortzipPrep) whose kind ≠ "Folder"
		--set targetFolder to hiFiles
		move targetFiles to hiFiles
		delete (every folder of sortzipPrep whose name is not "HIRES")
		make new folder at (sortzipPrep as text) with properties {name:"PREVIEWS"}
		
		--notify completion
		display notification "FONTS ZIPPED AND FILES SORTED"
		
	end tell
end open

Although the script might work there are a few confusions about wrong references.

After flattening sortzipPrep it’s an alias specifier.
In the Finder an alias can be used directly without extra file or folder specifier keywords.
And the result of a folder creation can be used as a reference, too


on open sortzipPrep
	local sortzipPrep
	set sortzipPrep to item 1 of sortzipPrep -- "on open creates a list of disk items"
	
	tell application "Finder"
		--pick and zip font folder
		set inputFolder to (choose folder default location sortzipPrep with prompt "Select font folder to be zipped")
		set qpp to quoted form of POSIX path of inputFolder
		do shell script "cd $(dirname " & qpp & ")
       zip -r \"$(basename " & "_TYPEFACES" & ").zip\" \"$(basename " & qpp & ")\""
		delete folder inputFolder
		--create new hires folder
		set hiFiles to make new folder at sortzipPrep with properties {name:"HIRES"}
		
		-- move files to HIRES
		set targetFiles to get every item of (entire contents of sortzipPrep) whose kind ≠ "Folder"
		--set targetFolder to hiFiles
		move targetFiles to hiFiles
		delete (every folder of sortzipPrep whose name is not "HIRES")
		make new folder at sortzipPrep with properties {name:"PREVIEWS"}
		
		--notify completion
		display notification "FONTS ZIPPED AND FILES SORTED"
		
	end tell
end open

Using your version of the script. it errors out after creating the zip file with the same “(-2710)” error. I do understand what you’re saying, though!