Actually this is a topic for ScriptBuilders, but unfortunately ScriptBuilders is still broken.
Inspired by Bruce Phillips’ BP Progress Bar (Thanks Bruce) I wrote a fully scriptable Cocoa application for the same purpose to be able to display a progress bar from plain AppleScript
You can download it here: SKProgressBar 1.0,
it runs on an Intel Mac with 10.5 or higher
For me in OS X 10.8.2, the script hangs with the new version.
tell progress bar
set indeterminate to false --> default is true
«event PrBrStMn»
repeat 6 times
«event PrBrIcRm» given «class bYVl»:10.0
delay 1
end repeat
«event PrBrSpMn»
end tell
Hi Stefan,
I can confirm Adam’s post about the new version. It hangs on or after “set indeterminate to false” by inserting this in the script:
tell progress bar
activate
set indeterminate to false
«event PrBrStMn» ”> this
tell current application
-- do shell script ...
end tell
repeat 10 times
«event PrBrIcRm» given «class bYVl»:10.0 ”> this
delay 1
end repeat
«event PrBrSpMn» ”> this
end tell
and these are the script replies:
tell application "SKProgressBar"
set image path to "path:to:me:Contents:Resources:my.icns"
set minimum value of progress bar to 0.0
set maximum value of progress bar to 100.0
set current value of progress bar to 0.0
set show window to true
activate
set indeterminate of progress bar to false
«event PrBrStMn» progress bar
--> error number -1708
Result:
error "SKProgressBar got an error: progress bar doesn't understand the «event PrBrStMn» message." number -1708 from progress bar
I too have 10.8.2 and I deleted all copies of the v1.0 of SKProgressBar.app, except the Time Machine.
For me, in Snow Leopard, the script compiled correctly but, when run, hung for several seconds until the system’s “application downloaded from the Internet” warning appeared. Since that was OK’d, everything seems to work fine.
PS. If I substitute Adam’s and flex20’s raw codes for the keywords, they don’t compile as keywords in the AppleScript Editor window and the script suffers the same problems when run. Maybe there are terminology clashes on Adam’s and flex20’s systems causing miscompilations?
PPS. If I save the correctly compiled script, close AppleScript Editor, zap SKProgressBar from my startup disk, and reopen the script in AppleScript Editor, the raw codes are different from those reported by Adam and flex20:
tell «class cRpB»
set «class iDtM» to false --> default is true
«event pGbRStMn»
repeat 6 times
«event pGbRIcRm» given «class bYVl»:10.0
delay 1
end repeat
«event pGbRSpMn»
end tell
PPPS. What’s the betting Script Debugger’s involved somehow?
The problem seems to be that Stefan has changed the four-letter codes between versions, and flex20 and Adam must have the old version still on their systems.
In particular, increment has changed from PrBrIcRm to pGbRIcRm, start animation from PrBrStMn to pGbRStMn, and stop animation from PrBrSpMn to pGbRSpMn.
I’m not sure why he made the change, but the solution is to remove the previous version, and convince ASE to remove it from its cache.
Hi Shane,
I have actually deleted what I think were all traces of v1.0, except for whatever is in the Time Machine. But just to make sure after your post, I booted on my clean volume I maintain for just such testing.
Then, I ejected my main volume, as well as a scrap volume I have, to make sure that nothing can be accessed on them.
Finally I run my script bundle with the SKProgressBar v1.0.1 in it. It crashed at the same place with the same message.
So, I really don’t think that the cause of the crash has anything to do with a clash of versions.
I also want to point out that I have now two scripts with integrated SKProgressBar v1.0 (I only discovered this app a few days ago) and they work perfectly on my 2010 iMac with 10.8.2.
I really can’t remember why I changed the four-character codes.
There were some inactive NSScriptCommand classes in the project, so I guess
I changed the respective commands from verb-first to object-first (Shane you know what I mean )
To be consistent the first 4-character codes have been changed to the parent class.
Hi Stefan,
Will you now release/post a new version? I checked v1.0.1 you posted at #7 above, but it is still yesterday’s version.
It’s no rush really, because v1.0 is working just fine.
Regards,
Chris
If the message contains “PrBrStMn”, then it’s using the old terminology. It may be just ASE caching it (this is another good reason to use Script Debugger). But whatever, the only place PrBrStMn is used is in the old version.
Try copying the code in Nigel’s message and see what it compiles to.
restored my clean test volume from a “virgin” 10.8.2 disk image with my basic configuration and disabled Spotlight;
restarted from it and then ejected my main volume to isolate the clean test volume;
opened a new blank script and copy/pasted the code from my original script and then saved the new script as a bundle with a new name;
navigated to it’s Resources folder and copied the SKProgressBar.app v1.0.1 to it;
compiled and saved it; (no app v1.0 or a script containing it, were in sight or ever run on that clean volume)
run it.
It crashed again at the same place, with the same raw codes but, slightly changed script replies:
tell application "SKProgressBar"
tell progress bar
activate
set indeterminate to false
«event PrBrStMn»
tell current application
-- do shell script ...
end tell
repeat 10 times
«event PrBrIcRm» given «class bYVl»:10.0
delay 1
end repeat
«event PrBrSpMn»
end tell
quit --> error number 0
end tell
(*Replies
tell application "SKProgressBar"
activate
set indeterminate of progress bar to false
«event PrBrStMn» progress bar
--> error number -1708
Result:
error "SKProgressBar got an error: progress bar doesn't understand the «event PrBrStMn» message." number -1708 from progress bar*)
While the script was frozen and SKProgressBar was still running, I checked that its version was indeed 1.0.1.
So, I think that shows that v1.0.1 in a clean script, running on a clean volume is still crashing with a reproducible error.