Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

robx2

macrumors member
Original poster
May 27, 2005
69
0
I've got a simple folder action set up with Automator that moves .mov files from a network drive to a folder on a local drive that Sorenson Squeeze uses as a watch folder to compress to flv.

The problem is that the local machine periodically gets shut down or restarted and the folder actions are no longer associated with the network folders.

is there a way to automatically attach a folder action at startup? I know I can't mount the volume at start up, but not sure how to precede beyond that. Or is there another workaround I can use to keep the folder actions associated with the network folder?
 

tedsmith3rd

macrumors member
Aug 30, 2006
54
0
US
System Events has a folder actions suite that I think can do what you want. In case you're not familiar with Script Editor's library:
  1. Open Script Editor
  2. Select "Library" from the "Window" menu
  3. Double Click "System Events" in the Library window
  4. Scroll down to "Folder Actions Suite" in the "System Events.sdef" window
If you need help getting it put together post back. I'm not much of a folder actions user.
 

HiRez

macrumors 603
Jan 6, 2004
6,265
2,630
Western US
Just be aware that I've found folder actions to be extremely flakey in Leopard, so much so that I've pretty much stopped using them altogether until they fix them. Note, however, that I have not tried using them since about 10.5.2 or so, so maybe they're better now (but I doubt it because some of the bugs are longstanding and predate Leopard). Problems include folder actions not working on more than one folder at a time, folder actions disabling themselves globally on restarts, folder actions enabled but not triggering, and still the inability of folder actions to wait until files are copied before starting (there's a workaround but it's tedious and error-prone).

Folder actions: great idea, poor execution.
 

numero

macrumors regular
Jul 23, 2002
106
3
OR
I concur with HiRez. I am fighting a folder action right now that doesn't seem to be firing. I'm thinking of just changing it over to a cron job. Not as sexy, but it gets the job done.
 

freiheit

macrumors 6502a
Jul 20, 2004
643
90
California
I third the sentiment

I concur with HiRez. I am fighting a folder action right now that doesn't seem to be firing. I'm thinking of just changing it over to a cron job. Not as sexy, but it gets the job done.

I second... no, third, the sentiment. I've not used Folder Actions before (been running OSX since Panther) and now that I found a use for them it isn't working well. Mine will work once but then seems to automatically disable itself (Leopard 10.5.4 on an Intel Mac Pro). Doesn't even require a restart, it just seems to happen after one execution or after some period of time elapses. It's very frustrating since I know the script is working and just can't get it to trigger 90% of the time.

Any other ideas on how to have a script continually monitor a folder, without hogging a lot of system resources, would be appreciated. I'm new to AppleScript but have passable Perl, PHP and shell script knowledge.
 

tedsmith3rd

macrumors member
Aug 30, 2006
54
0
US
Any other ideas on how to have a script continually monitor a folder, without hogging a lot of system resources, would be appreciated. I'm new to AppleScript but have passable Perl, PHP and shell script knowledge.

You could try Launch Services, the underlying system that drives folder actions. Write Perl or PHP script, make it executable, then have launch services run it when a folder changes. Lingon is an excellent free front end to the launch services interface. And using it directly has less overhead than using folder actions, so it MIGHT be more reliable. Again, I don't use folder actions so I don't know for sure.
 

HiRez

macrumors 603
Jan 6, 2004
6,265
2,630
Western US
You could try Launch Services, the underlying system that drives folder actions. Write Perl or PHP script, make it executable, then have launch services run it when a folder changes. Lingon is an excellent free front end to the launch services interface. And using it directly has less overhead than using folder actions, so it MIGHT be more reliable. Again, I don't use folder actions so I don't know for sure.
I looked into this a while ago and the problem I ran into is that while there is a LaunchServices callback you can set to trigger a script when something in the filesystem changes, it doesn't send the folder the change even occurred in (or any other info) as an argument when it calls your script. Which is just a terrible design oversight because you can't tell from the script what actually changed, which makes it kind of useless.
 

tedsmith3rd

macrumors member
Aug 30, 2006
54
0
US
I looked into this a while ago and the problem I ran into is that while there is a LaunchServices callback you can set to trigger a script when something in the filesystem changes, it doesn't send the folder the change even occurred in (or any other info) as an argument when it calls your script. Which is just a terrible design oversight because you can't tell from the script what actually changed, which makes it kind of useless.

Yeah, that seems like an annoying limitation. But if you're only monitoring one path then you can either hard-code it into your program or pass the path as an argument to your program from your launchd plist.
 

freiheit

macrumors 6502a
Jul 20, 2004
643
90
California
Thanks for the suggestions

Yeah, that seems like an annoying limitation. But if you're only monitoring one path then you can either hard-code it into your program or pass the path as an argument to your program from your launchd plist.

Thanks for the suggestions. I'll look into that.
 

krimb1

macrumors newbie
Aug 22, 2006
17
0
Still a problem

I second... no, third, the sentiment. I've not used Folder Actions before (been running OSX since Panther) and now that I found a use for them it isn't working well. Mine will work once but then seems to automatically disable itself (Leopard 10.5.4 on an Intel Mac Pro). Doesn't even require a restart, it just seems to happen after one execution or after some period of time elapses. It's very frustrating since I know the script is working and just can't get it to trigger 90% of the time.

Just wanted to chime in and say I'm running into the exact same roadblocks as freiheit on a MacBook Pro running 10.5.4. Leopard's done a lot of changes with security and administrator privileges; do you think it might have anything to do with that?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.