Re: Folder Actions Unreliable?
Re: Folder Actions Unreliable?
- Subject: Re: Folder Actions Unreliable?
- From: Tommy Bollman <email@hidden>
- Date: Fri, 28 May 2010 11:57:18 +0200
On 28. mai 2010, at 11.34, Steve Thompson wrote:
>
> (Just resending from the correct address so listmanager doesn't bounce it!)
>
> First, I just wanted to mention what a cool name you've got.
>
> Folder actions are notoriously slow AND they're just an extra layer on top of launchd. I've found that using launchd to run your script improves the reliability of AppleScripts (YMMV).
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
> <plist version="1.0">
> <dict>
> <key>Disabled</key>
> <false/>
> <key>Label</key>
> <string>com.domain.myapplescript</string>
> <key>Program</key>
> <string>/usr/bin/osascript</string>
> <key>ProgramArguments</key>
> <array>
> <string>osascript</string>
> <string>/Library/Scripts/myapplescript/myapplescript.scpt</string>
> </array>
> <key>WatchPaths</key>
> <array>
> <string>/Volumes/path/to/folder/to/watch</string>
> </array>
> <key>RunAtLoad</key>
> <true/>
> <key>onDemand</key>
> <true/>
> </dict>
> </plist>
>
> Call this file com.domain.myapplescript.plist and put it in to your (not the systems) /Library/LaunchAgents/ folder.
>
> At restart/login launchd will see this file and act on it. You can control it from the command line with
>
> launchctl load ~/Library/LaunchAgents/com.domain.myapplescript.plist
>
> Hope this helps
>
> Steve
>
>
> On 28 May 2010, at 04:36, Steve Thompson wrote:
>
>> I'd love to hear some of your experiences, so I know if I'm chasing my tail or not.
>>
>> I've commonly used Folder Actions to do various things with generally good results. However I recently set up an Automator Workflow that takes the Finder Items dropped in a folder, renames them (actually adds a suffix before the extension) and moves them to a finished files folder.
>>
>> Dropping a file or two on the watched folder works fine, however the purpose of this is to act on a bunch of exported files from Final Cut Server (via compressor). Often this results in a barrage of 20-30 files being added to the folder in relatively short order. The problem is that the Workflow runs only some of the time. Of perhaps 30 files exported to this folder, there will be 7-8 stragglers that just never get renamed and moved, no matter how long I wait. If I do the export again, the results may be better or worse and may or may not include the same subset of files.
>>
>> Has anyone else had issues with Folder Action reliability in something as simple as this? I made my Folder Action in Automator simply because rename and move took me less than 5 minutes to make, but I could easily create the same thing with an Applescript, but I wonder if the results would be any more reliable or is this just a "feature" of Folder Actions?
>>
>> Any thoughts?
>>
>> Steve
>>
>>
>> Steve Thompson
>> email@hidden
>>
>>
>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> AppleScript-Users mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> Archives: http://lists.apple.com/archives/applescript-users
>>
>> This email sent to email@hidden
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
Well well well, -I never thought of executing scripts directly with osa script, thats an improvement over applets.
- I did a proof of concept the other day. -To avoid respawning while waiting for say a busy file.
- really don't know if I have to do this, but i was curious.
You can have a shellscript call an applet which then executes launchctl and kills the originator.
Then the applet must of course transfer control to another process that does the rest of the job,
and finally restarts launchctl. - Perfectly possible.
Best regards
Tommy Bollman
--------------------------------------------------------------------------------------------------
You will be advanced socially,
without any special effort on your part.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden