applescript Folder Action not triggering subsequent automator FA

Hi, I am trying to accomplish the following:
User copies media files (video, music, pictures) into folder. I have an applescript folder action set up that moves all the files into separate folders which each have an Automator action tied to them.

The applescript folder action works perfect. I have essentially done the following:

On adding files to this_folder after receiving these_items
try
do shell script “mv sourcedir/.[Mm][Pp]3 destinationdir"
end try
try
do shell script "mv sourcedir/
.[Ww][Aa][V] destinationdir”
end try
try
do shell script “mv sourcedir/* desintationdir”
end try

end adding folder items to

This works perfectly and moves all the files into their proper folders, but then it doesn’t trigger the subsequent folder actions, which are automator workflows that either import the song, convert the image then import, convert video then import, etc etc etc.

If I comment the “On adding files to…” and “end adding…” and run it, it copies but still doesn’t work.

If I copy a file into the specific destination folder then the subsequent folder action works perfectly.

I have all the try’s in there because without it, the script will just stop when it encounters the first error.

At one point I believe it had worked fine for one user, but I started duplicating it to the multiple users (I assumed it was working) by the time I implemented it on the other users it stopped working.

I do NOT know applescript by any means and am throwing together what basic information I know between applescript/unix/automator and trying to get this to work. I’m not sure if this is now a Folder Action problem or if it’s a problem with my Applescript. The FA seems to trigger properly on its own but now flowing from one to the next it doesn’t work. Please help!

Just an update. Instead of having an folder action to trigger the subsequent folder actions, I simply put all the processing in the initial folder action.

So it looks like this
Move file to folder A/B/C → process file in folder A/B/C accordingly and import

But all of this is triggered by the first FA.

Unfortunately (fortunately?) I had to learn how to do all the processes I wanted to do in Automator in Applescript. Not quite as hard as I imagined.

Hi, Mhoward84. Welcome to Maccripter.

Sorry to see you didn’t get a reply to your query.

I myself have very little experience with Automator and didn’t even know workflows could be attached to folders. Now, after a little research, I’ve established that your original idea should work ” although the passing-round can take quite a while! On my machine, using a folder with an attached AppleScript which passes items to another folder with an attached Automator workflow which speaks a simple phrase, there are fully ten seconds or more between the item(s) being dropped into the first folder and the phrase being spoken.

Given that the idea works in principle, there’s no way to tell without further information why it’s not been working for you. Obviously the script in your first post doesn’t even compile, let alone work, and the shell scripts appear to ignore the handler parameters altogether.

That suggests that the problem’s in the script rather than in the set up. Are you sure the files are getting to the destination folders? What happens if you actually use the ‘try’ statements to show error messages?

try
	do shell script "mv sourcedir/*.[Mm][Pp]3 destinationdir"
on error errMsg
	display dialog errMsg
end try

Anyway, I’m glad you’ve now got a working arrangement. It should be faster now you’re using an AppleScript attached to the original folder. :slight_smile:

Thanks for the reply Nigel!
I’m not sure if I waited a sufficient 20-30 seconds for the file to flow through all my folder actions, I will look for that next time, thank you.

The script itself worked perfect and moved the files properly.
If I removed it from a folder action it would give errors every time I tried to move a file type that didn’t exist, but the TRYs pushed the script past all the erorrs so it seemed like it was working.

Also, I will add the dialog next time so I can verify if that matches the error I was getting when outside of the FA to make sure nothing was stopping it. Thanks!