Well, it almost works. There are some processes that output nothing to the cmd line window except perhaps a line feed or EOF I am assuming at the end. These work fine with the following script:
Code: Select all
on ProgressBarWithProcess pStartValue, pEndValue, pProcess, pProgressBarName, pHideOnCompletion, pEndProcessString
-- This handler shows progress on a progress bar while a process is running the background.
-- pStartValue - where should the progress bar start. In a sequences of processes, use to start at a higher start value.
-- pEndValue - where should the progress bar end. Assumes that seconds are the time unit.
-- pProcess - name/path of the process to execute.
-- pProgressBarName - name of the scrollbar/progress bar object
-- pHideOnCompletion - 1 or 0. Hides the progress bar once completed.
-- pEndProcessString - Optional. String that is normally output in a DOS window when the process is complete.
set visible of scrollbar pProgressBarName to true
set startValue of scrollbar pProgressBarName to 0
set endValue of scrollbar pProgressBarName to pEndValue
put pProcess into vLaunchedProcess
open process vLaunchedProcess
repeat until vLaunchedProcess is not among the lines of the openProcesses
repeat with vCurrentValue = 0 to pEndValue
set the thumbPosition of scrollbar pProgressBarName to vCurrentValue
wait 1 sec
if vLaunchedProcess is not among the lines of the openProcesses then
set the thumbPosition of scrollbar pProgressBarName to pEndValue
exit repeat
end if
end repeat
end repeat
wait 1 sec
-- if pHideOnCompletion is 1 then set the visible of scrollbar pProgressBarName to false
end ProgressBarWithProcess
Unfortunately, when the process actually does output something to the DOS Window, then it does not work. For example, one of my DOS commands outputs "Finished in xx.xxxxxx seconds." when complete.
How and where would I put the read from process until, let's say the string is "Finished."
Larry