Last active
July 7, 2019 13:17
-
-
Save jorng/23eb613d729450e76822 to your computer and use it in GitHub Desktop.
Simple AppleScript progress bar demo for Yosemite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.