|
|
|
Use launchd to replace folder actions
The biggest problem I've found with using launch daemons is that you can't pass the name of the added item. Using folder actions, you can get the name and the path of each item added. For example:
Using launch daemons, there is no argument passed to your script providing the name or the path of the item. It makes it difficult to manipulate this new file without knowing it's name or path. Am I wrong?
Use launchd to replace folder actions
It simply depends on your needs. In my case, I know that there will be one to many tiff-files which need to be ocr'ed. It's very simple to get a list of files with AppleScript:
tell application "Finder" set myFolder to alias "Volumename:path:to:folder:" set myList to every file of myFolder as alias list end tell You then have an array with all the files as alias. With a repeat or while or whatever kind of loop you can process the files.
Use launchd to replace folder actions
Well, I suppose (have not tried) that launchd when calling whatever.sh would be passing it each item one-by-one (i.e. calling it several times if multiple items were added). In case of /bin/sh they will be known to shell script as $1, and then will be passed over to AppleScript. So, you should have all the same (or similar) info and control, no?
|
SearchFrom our Sponsor...What's New:HintsNo new hintsComments last 2 days
Links last 2 weeksNo recent new linksWhat's New in the Forums?
The Editor's Corner...Here are some of my (robg) other projects...
Hints by TopicNews from Macworld
The macosxhints PollWhat version of OS X are you running as your main OS?
Other polls | 11,517 votes | 42 comments
|
|
Copyright © 2009 Mac Publishing LLC (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Powered by Geeklog Created this page in 0.03 seconds |
|