Custom folder action not complete execution?

Hi there, this is my second post today. hope to find a solution as I’m going crazy with this thing.

I’m running Mountain lion.

I need to have a custom script running as “folder action”.
The problem is that not all the script is being executed!

  1. Automator custom folder scripts are working

  2. Standard apple .scrpt (the standard list of scripts you see when choosing “set folder action”, are working

  3. When I modify one of those standard scripts, (add- alert when adding files) and assign it to my folder, then nothing happens!

I restarted the computer, then the script worked, but not at 100%. I know it was called because i added Say “Working” and my computer said working, but in fact, no dialogs appeared, nothing of nothing.

I think it’s a bug, but i need a applescript for my project, i think automator isn’t good for what i’m looking to do.
If you need to understand more, check this link where i explained my application


I read quickly the pointed thread.

If I understand well what you want is that the script save the added files somewhere.
From time to time the “something was added” message is not treated by the system.
This is why when such a message is passed, I scan the contents of the folder to build a list of every files which were not treated before.

Here is the skeleton of such a script :

property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.

on adding folder items to this_folder after receiving added_items
	tell application "System Events"
		set theMP3s to name of every file of this_folder whose type identifier is "public.mp3"
	end tell
	# now we have a list containing the names of every MP3 stored in the folder.
	# This list contains the last MP3 whose addition was reported and those whose addition wasn't reported.
	# This way, every MP3 will be treated (some with a delay but we can't change the system behavior)
	set alert_message to my recolle(theMP3s, return)
	display dialog the alert_message buttons {"Yes", "No"} default button 2 with icon 1 giving up after dialog_timeout
end adding folder items to


on recolle(l, d)
	local oTIDs, t
	set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d}
	set t to "" & l
	set AppleScript's text item delimiters to oTIDs
	return t
end recolle


KOENIG Yvan (VALLAURIS, France) vendredi 26 juillet 2013 16:28:30

well, i think that this is a different approach to the same situation…
actually i’m using some shell commands because are very good for what i need to do in my script.

i have to check if i can do the same operations via System events … maybe they give more flexibility…
Shell commands are the best way for me, but sometimes you have to write lot of code…wich i prefer to keep slimpe as i can!

I think the script wasn’t casting due some bug… i wrote it again from scratch, with the help of another user …
i’ve read my external plist file, then rebooted and it worked!

this did the job

on adding folder items to this_folder after receiving these_items

…everything is ok! when i move a file to the folder, the script is working, also when a download finishes, the script works!
happiness :smiley: