I’ve managed to get a progress bar in my main window, but it just gives the barber pole effect. I would like it to actually give the user at least some vague idea of how much time is remaining to run.
I’ve looked at various sample projects and the ASKit.dictionary but i’m stumped!
I use this routine to update the progress bar. Of course, update the element names to match your project. To set the progress bar to a barber pole (indeterminate progress), set the iteration to 0, otherwise use an accurate iteration and total_count to update the progress bar accordingly:
Jon
[This script was automatically tagged for color coded syntax by Script to Markup Code]
Um, what’s the “update_object” handler? The code I listed above is a handler that is not automatically created, you have to add it your self. To use it, call it from within your script, for instance, when a button is clicked. What you would do is in the “on clicked” handler, do something that required a repeat loop like:
Of course, again, this requires that your progress bar and label in the main window are named accordingly.
Jon
[This script was automatically tagged for color coded syntax by Script to Markup Code]
The variation on it in this project is that the progress bar is in a separate panel window with more explicit handlers for showing, updating, and hiding the progress panel.
Thanks jonn8, but I find it hard to follow that script. I’m back for my second attempt at getting that progress bar working. I’d really like to get it figured out.
2 things I have a hard time following in your most recent example -
handlers for things like ‘activated’, ‘launched’, and ‘will finish launching’ that seem to be empty. Are they just from your template and not used. If so, no offense, but since it’s a tutorial of sorts couldn’t they be removed? Or do they have a purpose?
Also your use of this line in every handler
my update_status("event handler name " & object_name)
what is that for?
tell window "main"
set uses threaded animation of progress indicator "ProgressBar" to true
start progress indicator "ProgressBar"
set content of progress indicator "ProgressBar" to (a number out of 100)
end tell
Your window needs to be named “main” in the AppleScript section of Interface Builder, or anything else, just remember to change it in the code too. Also, the progress bar has to be named something as well. You can set the contents to any number, probably 1 at the beginning. At the points where you want to update the progress bar, just stick thin in your script:
tell window "main"
set content of progress indicator "ProgressBar" to (the number you want the progress bar to be, out of 100)
end tell
To stop the progress bar:
tell window "main"
set uses threaded animation of progress indicator "ProgressBar" to false
stop progress indicator "ProgressBar"
set content of progress indicator "ProgressBar" to 0
end tell