Folder action not working on other mac

I’ve created a folder action which renames dropped files. On my macbook the script works great and does exactly what it has to.

When I add the action to a folder on any other mac (I copy the script to the local action folder scripts first) or on a network folder nothing happens.

I tried all kinds of trick listed in the forums but nothing helped. Is there something wrong in the script or am I forgetting something ?

on adding folder items to theFolder after receiving theFiles
	
	repeat with i from 1 to number of items in theFiles
		tell application "Finder"
			set this_item to item i of theFiles
			set the item_info to the info for this_item
			
			set the the_file_name to the name of this_item
			
			--strip at5 date from file name
			
			set the_file_name to text ((offset of "_" in the_file_name) + 1) thru -1 of the_file_name
			
			
			--  create the timestamp
			
			set TheDate to the current date
			copy TheDate to b
			set the month of b to January
			set monthNum to (1 + (TheDate - b + 1314864) div 2629728)
			if (monthNum < 10) then
				set monthNum to "0" & (monthNum as string)
			end if
			set yearNum to the ((year of TheDate) - 2000)
			if (yearNum < 10) then
				set yearNum to "0" & yearNum
			end if
			set dateNum to the day of TheDate
			if (dateNum < 10) then
				set dateNum to "0" & dateNum
			end if
			set hourNum to the hours of TheDate
			if (hourNum < 10) then
				set hourNum to "0" & hourNum
			end if
			set minuteNum to the minutes of TheDate
			if (minuteNum < 10) then
				set minuteNum to "0" & minuteNum
			end if
			set secondNum to the seconds of TheDate
			if (secondNum < 10) then
				set secondNum to "0" & secondNum
			end if
			
			-- set date + old name
			set theNewName to (yearNum as string) & (monthNum as string) & (dateNum as string) & "_" & (hourNum as string) & (minuteNum as string) & (secondNum as string) & "_" & (the_file_name as string)
			
			
			-- rename the file to the new file name
			set the name of this_item to theNewName
			
		end tell
		
	end repeat
	
	
	
	
end adding folder items to

Thanks in advance for any help!

Hi,

your script should work on every machine, if folder actions are enabled and the script is properly connected to the hot folder.
Btw: Here is a smaller version of the script


on adding folder items to theFolder after receiving theFiles
	repeat with oneFile in theFiles
		set the_file_name to name of (info for oneFile)
		set theNewName to (do shell script "/bin/date +%y%m%d_%H%M%S_") & text ((offset of "_" in the_file_name) + 1) thru -1 of the_file_name
		tell application "Finder" to set name of (contents of oneFile) to theNewName
	end repeat
end adding folder items to

Edit: the script above causes an infinite loop, because the folder action will be triggered again and again
after the file was renamed, try this instead


on adding folder items to theFolder after receiving theFiles
	repeat with oneFile in theFiles
		set the_file_name to name of (info for oneFile)
		set theNewName to (do shell script "/bin/date +%y%m%d_%H%M%S_") & text ((offset of "_" in the_file_name) + 1) thru -1 of the_file_name
		if the_file_name does not start with text 3 thru 4 of (year of (current date) as text) then
			tell application "Finder" to set name of (contents of oneFile) to theNewName
		end if
	end repeat
end adding folder items to

Thanks for your input!