Skip to content

Instantly share code, notes, and snippets.

@jorng
Last active July 7, 2019 13:17
Show Gist options
  • Save jorng/23eb613d729450e76822 to your computer and use it in GitHub Desktop.
Save jorng/23eb613d729450e76822 to your computer and use it in GitHub Desktop.
Simple AppleScript progress bar demo for Yosemite
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
Copy link

ghost commented Apr 6, 2016

Amazing!

@kscheff
Copy link

kscheff commented Sep 16, 2016

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.

@RobLewis
Copy link

Does the value of -1 that progress total steps is initialized to have some special meaning?

@dgpokl
Copy link

dgpokl commented Feb 15, 2017

@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