To Be gnu/Hurd
Mon, 07 Jul 2008
Folder actions in Leopard are a pain in the ass
I recently got a Macbook, and ran into the need to save all .torrent files to a specific directory. Safari saves all files to a single directory by default, which made this impossible. To get around this I attempted to make a Folder Action for the Downloads folder. It all sounded quite simple. Unfortunately, Apple hasn't quite finished this part of the OS yet.
My first mistake was assuming that the Automator script would be passed the files that had changed, when in fact the script is passed only the Folder Action directory. After figuring this out I tried saving everything as an Application and then using that for the Folder Action. Nope! Apparently you have to save your Automator script as a "Folder Action plug-in", which actually creates 2 files:
- ~/Library/Scripts/Folder Action Scripts/actionname.scpt
- ~/Library/Workflows/Applications/Folder Actions/actionname.app
Even after figuring all of this out I am still pretty unhappy with how it works. Every time a file is downloaded the script is run, which steals focus repeatedly until it is finished. I think I will have to go ahead and write a python or perl script to do such things. Hopefully there is something akin inotify or FAM that I can use.
Follow-up: I found a program called Hazel which handles all this much better.
Comments