Remove Paths From Filenames

This will strip out paths that Automator passes. Useful for listing files in documents. (thx: Bruce Phillips)

set filenameList to {}
set ASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {", "}

tell application "Finder"
	launch
	repeat with thisFolder in input
		set filenameList's end to (name of every item of thisFolder) as Unicode text
	end repeat
end tell

set AppleScript's text item delimiters to {ASCII character 10}
set the clipboard to filenameList as Unicode text
set AppleScript's text item delimiters to ASTID

H I know its been a couple of years since this was posted but Im having an issue with it it
I get the following error code when I run it

“The variable input is not defined.”

and the issue is at the input
ie
“repeat with thisFolder in input

Please help as I need to strip the path’s out of a generated text file of 100 doc’s!!

thanks