-
-
Save jorng/23eb613d729450e76822 to your computer and use it in GitHub Desktop.
set progress description to "A simple progress indicator" | |
set progress additional description to "Preparing…" | |
set progress total steps to -1 | |
delay 5 | |
set progress total steps to 100 | |
repeat with i from 1 to 100 | |
try | |
set progress additional description to "I am on step " & i | |
set progress completed steps to i | |
delay 0.2 | |
on error thisErr | |
display alert thisErr | |
exit repeat | |
end try | |
end repeat |
Amazing!
I am using the progress bar in an applescript project. However when using this in a droplet (.app) there is an issue that the progress does not disappear anymore when the droplet is not exiting. Any idea to make it disappear?
I tried:
setting all items to 0, false, null .... the progress just stays in the screen in the background.
Does the value of -1 that progress total steps is initialized to have some special meaning?
@RobLewis, it looks from my experimentation that the -1
is what makes it show the progress indicator as intdeterminate. When running in the Script Editor, this makes it a spinny thingy (instead of a pie), and when it's an Application, it shows the progress bar filled solid when total steps is at -1
(instead of showing one at 0%). I think it's what you would do when you're doing some kind of startup work (especially when you don't know how long it'll take) before you enter your main processing loop.
Great example! I think it's great Apple finally added this simple functionality for applets. Have you by chance figured out a way to close/hide the progress window during the script? I have many scripts that have several stages, using dialogs between stages. When the progress window is still active in the background, it looks sloppy or as if there's a problem to the user.