Droplet folder/files

I don’t know why this is giving me so much trouble but…
I created a simple droplet that changes the name of the files dropped on it. How do I get the same droplet to change the names of files in a folder if I decide to drop a folder on it, without it changing the name of the folder?
Can the same droplet be used for a folder full of files AND
dragged files? I hope this isn’t asking too much, but I’d also like to know if the same droplet can have a different function when it’s double-clicked.
Thanks in advance,
Gary S.

: I don’t know why this is giving me so much trouble but…
: I created a simple droplet that changes the name of the
: files dropped on it. How do I get the same droplet to
: change the names of files in a folder if I decide to
: drop a folder on it, without it changing the name of
: the folder?
: Can the same droplet be used for a folder full of files
: AND
: dragged files? I hope this isn’t asking too much, but I’d
: also like to know if the same droplet can have a
: different function when it’s double-clicked.
: Thanks in advance,
: Gary S.
One way to do this (the folder business) is to put the name change code in its own handler and to use the main loop to distinguish between folders and files. This script works with any files dropped on it and/or the files (only) of any folders dropped on it. Its possible to write a script to work on the files of subfolders too - but this isn’t it. :slight_smile:

on run
	-- A different function when double-clicked
end run
on open theItems
	tell application "Finder"
		repeat with thisItem in theItems
			if the kind of thisItem is "folder" then
				get every file of thisItem
				repeat with thisFile in the result
					my changeName(thisFile)
				end repeat
			else
				my changeName(thisItem)
			end if
		end repeat
	end tell
end open
on changeName(thisFile)
	-- Your name change code here
end changeName

NG

I’m feeling pretty dumb right now. :slight_smile:
Thank you, thank you, thank you.
GS