|Feb 7, 2009, 12:05 PM||#1|
AppleScript and do shell script
I have a rather lengthy script I'm using as a folder action for automatic video conversion, essentially it boils down to "add (extension) to this folder? ok, pass it to a shell script and convert."
This works fine, except for one thing -- since the folder action is still running while it's running "do shell script (conversion line)", any files added during the conversion are ignored. This is unacceptable, because video conversion takes so darn long.
|Feb 7, 2009, 12:58 PM||#2|
You could have your script maintain a queue of files to be processed. Store the original list of files and then, after each conversion, drop the current (just converted) file off the list, get a list of the current contents of the drop folder and compare that to the original list, adding into the queue the new ones. Kind of a PITA but it should work.
Alternately, you could launch each conversion process as a background process, allowing the AppleScript to immediately return and become available for relaunching. The only problem there is that all those processes will be run simultaneously instead of one at a time, which could cause problems with CPU starvation or low memory if you drop a lot of files at once. You can launch a "do shell script" as background by appending " &> /dev/null &" to the end of your command-line section (note the space between this and your original command):
do shell script "ftp blah blah blah &> /dev/null &"
Go outside, the graphics are amazing!
|Feb 7, 2009, 01:01 PM||#3|
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Use backslash in Applescript running a Bash Shell Script||rebello95||Mac Programming||12||Nov 3, 2011 01:56 PM|
|Resolved: Applescript and lists||Roadrun3r||Mac Programming||6||Jun 5, 2011 06:20 AM|
|Applescript shell script won't run when display is sleeping||BlueRevolution||Mac Programming||6||Feb 19, 2011 03:11 AM|
|Browse for shell script applescript||flashuni||Mac Programming||1||Jul 9, 2008 09:31 PM|
|Shell Script / AppleScript - backing up FlashDisks?||satans_banjo||Mac Programming||0||Oct 9, 2006 09:44 AM|
All times are GMT -5. The time now is 06:13 AM.