How do you check if an application is busy?
Here's what I'm wanting to do. I have a folder full of wav files I want to use oggenc from the shell to encode them to ogg vorbis files, so to keep myself from entering the files one by one into the shell I'm resorting to automator + applescript to do all that work for me. I have it grabbing the files from finder and also grabbing folder contents if there are any folders.
oggenc works like so:
oggenc -q 10 "/path/to/file.wav"
You can do multiple files at once, but I run into a problem where the amount of characters in the filenames get too long for it to parse. Terminal will repeatedly like a machine gun beep at me. Doing multiple files at once isn't the right way to go anyways because I want to eventually write a way to convert the metadata from the wav file to the ogg file.
If I do something similar to this in AppleScript:
on run {input, parameters}
tell application "Terminal"
activate
repeat with loop from 1 to (count input)
do script "oggenc -q 10 \"" & item loop of input as string & "\"" in window 1
end repeat
end tell
end run
I know I can do this by doing this as a shell script, but I want it to show the terminal window, so I'm going about it this way. It will tell it almost all at once to do all of those commands and terminal might be lucky to grab about 4 of those before it quits. Is there some way to delay the AppleScript until Terminal is not busy doing the first command I sent before moving to the next? Or am I just going about this the wrong way?
Powerbook G4 1Ghz Mac OS X (10.4.6)
oggenc works like so:
oggenc -q 10 "/path/to/file.wav"
You can do multiple files at once, but I run into a problem where the amount of characters in the filenames get too long for it to parse. Terminal will repeatedly like a machine gun beep at me. Doing multiple files at once isn't the right way to go anyways because I want to eventually write a way to convert the metadata from the wav file to the ogg file.
If I do something similar to this in AppleScript:
on run {input, parameters}
tell application "Terminal"
activate
repeat with loop from 1 to (count input)
do script "oggenc -q 10 \"" & item loop of input as string & "\"" in window 1
end repeat
end tell
end run
I know I can do this by doing this as a shell script, but I want it to show the terminal window, so I'm going about it this way. It will tell it almost all at once to do all of those commands and terminal might be lucky to grab about 4 of those before it quits. Is there some way to delay the AppleScript until Terminal is not busy doing the first command I sent before moving to the next? Or am I just going about this the wrong way?
Powerbook G4 1Ghz Mac OS X (10.4.6)