I’ve been using Shane Stanley’s superb AsObjC Runner to provide a progress bar in AppleScripts that may be used in pre-Yosemite systems. For various reasons that you can guess but which I can’t say, this method will cause problems in the future, and I now want to make my scripts use native AppleScript progress bars and run only in Yosemite or later.
What I can’t figure out is how to translate the syntax of AsObjC Runner into native AppleScript. My AsObjC syntax looks like this:
set properties of progress window to {button title:"Cancel", button visible:false, message:"Converting...", detail:cnvFile, indeterminate:false, max value:4, current value:0}
As you see, my dialog displays the name of the file currently being converted (from the variable named cnvFile), and the “current value” is set at different points in the script.
I’ve been scratching my head over this, and will be grateful for any help.
Partial answer: I see that this method using timing to determine which stage number to display; what I can’t figure out is how to set the “Conversion stage” number to a number set elsewhere in the script.
set cnvPosix to POSIX path of cnvFile
set progress description to "Converting " & cnvPosix
set progress additional description to "Preparing."
set progress total steps to -1
delay 0.5
set progress total steps to 4
repeat with i from 1 to 4
try
set progress additional description to "Conversion stage " & i
set progress completed steps to i
delay 0.2
on error thisErr
display alert thisErr
exit repeat
end try
end repeat
I see - you mean I can set “Applescript’s progress completed steps” anywhere in the code.
I’ve been looking for it! Can you point me to it? You mentioned in another post that there were progress apps out there but I wasn’t able to find them.
Yes, but when I was searching yesterday, I didn’t know that StefanK had written this and had no way of knowing that he wrote it, so I had no way of knowing that I should search for his name. All I knew was that Shane wrote that apps exist to provide progress bars. A search for
progress bar
in the keyword field did not bring it up on either the first or second page of the search. I should have gone on to the third page, where it does appear, but I lazily assumed it would show up earlier. I’ll know better next time. Thank you again!