|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|
|Apple script batch shell script||prramesh||Mac Programming||5||Sep 15, 2013 03:35 AM|
|AudioScope.sh shell script...||wisecracker||MacBook Pro||0||Jul 31, 2013 01:31 PM|
|Shell Script to Sync iPhoto||ajbudis||Mac Programming||0||Jun 30, 2013 12:52 PM|
|Anyone know how to use AppleScript or shell-script?||gba2000||Mac Applications and Mac App Store||0||Apr 23, 2013 11:14 AM|
|Need help with a shell script||thatgreenvw||Mac Programming||1||Nov 30, 2012 07:55 AM|
All times are GMT -5. The time now is 03:08 PM.