Feeding progress bar with do shell script output

Hi there,
I am using a do shell script that runs qt_export, to export quicktime movies to wmv. I’d like to have some kind of progress info in my main window app.

Most of the options I’ve found here are focused on batch processes, which is not the case. And on the other hand all that I found regarding single processes (not batches) are indeterminate progress bars.

Qt_export outputs a progress live feedback when run in Terminal, like this:

progress: (013:001) 18.67% test.mov → test.wmv

progress: (013:001) 21.33% test.mov → test.wmv

progress: (013:001) 24.00% test.mov → test.wmv

progress: (013:001) 26.67% test.mov → test.wmv

progress: (013:001) 29.33% test.mov → test.wmv

But when I do shell script, I don’t get it in “real-time” but when the process is finished. How could I write that to a file and read it to feed my progress bar?

Thanks.

Self reply :slight_smile:

In the same do shell script command line, I write a file with the output of the shell but as a process in the background:

do shell script "any_commands_you_need > path/myFile.txt 2>&1 &"

Then I load a part of the output in myFile.txt (the percentage number) and pass it to a indicator progress bar in the IB. One thing it took me a while is to realize that to make the progress bar update continuously a progressBar’s setUsesThreadedAnimation_(true) need to be added in the script, somewhere before the progressBar’s setDoubleValue_(percentageNumber).

newbie here :o

how did you do this??

i want to get a progress bar from a single shell script too:
do shell script “find projectFolder -name ‘*.als’ -print0 | xargs -0 -J {} ln -fs {} tempSymFolder”

ty ty :smiley:

It’s impossible.

Either the script must contain a loop to be able to increment the progress counter, or the process must run asynchronously.

/usr/bin/find fulfills none of the conditions.