No, it’s not possible. You need a loop to increment the counter
[Ann] Version 1.8, updated to Swift 5 with Catalina and Dark Mode support.
SKProgressBar is code signed and notarized.
Link: SKProgressBar1.8
SKProgressBar is a godsend! I had been using ProgBar as my progress bar, but it is no longer functional under Catalina. After some searching for a substitute, I came upon SKPB, and my prayers were answered!
I especially love the ability to include images in the bar. I have a question regarding that - is there any way to make the image field larger? App icons show up great in the bar, but images from JPEGs et al are often too tiny to be recognizable.
Thanks for providing this!
Thanks for the update, but it won’t run for me, running Script Debugger 7.0.11 (7A106) on macOS 10.14.6 (Mojave).
I get this error running your demo SKProgressbarDemo.scpt:
on this line:
set «class hDsZ» to «constant hfSZrgSZ» --> default is small
How do I fix it?
Just for reference, here is the entire script:
property currentValue : 0.0
property maxValue : 10.0
set iconPath to (path to applications folder as text) & "iTunes.app:Contents:Resources:iTunes.icns"
tell application "SKProgressBar"
activate
---------------------------------------------------
-- SETUP WINDOW THAT CONTAINS ALL PROGRESS BARS --
---------------------------------------------------
set title to "Demo of SKProgressBar 1.6" --> default is "SKProgressBar"
set floating to false --> default is true
set position to {100, 100} --> default is {1000, 750}, origin point is bottom left
set width to 400.0 --> default is 500.0
---------------------------------------------------
-- SETUP MAIN PROGRESS BAR --
-- (progress bar 1 by definition)
---------------------------------------------------
-- It already exists, so no need to create
tell main bar --main bar
set minimum value to 0.0 --> default is 0.0
set maximum value to maxValue --> default is 100.0
set current value to currentValue --> default is 0.0
-- header / footer properties
set header to "MAIN Progress Bar" --> default is empty string
set header alignment to center --> default is left
set «class hDsZ» to «constant hfSZrgSZ» --> default is small
set footer to "footer" --> default is empty string
set footer alignment to center --> default is left
set «class fTsZ» to «constant hfSZmiSZ» --> default is small
-- image path can be HFS or POSIX path, default is missing value (no image)
set image path to iconPath
end tell
---------------------------------------------------
-- CREATE & SETUP PROGRESS BAR #2 --
---------------------------------------------------
set progressBar2 to make new progress bar at after progress bar 1 with properties {header:"TEST Progress Bar #2", header alignment:center}
tell progressBar2
set maximum value to maxValue
set current value to currentValue
end tell
---------------------------------------------------
-- DISPLAY/ACTIVATE THE PROGRESS BARS --
---------------------------------------------------
-- This will show one window will all progress bars
set show window to true --> default is false
tell main bar
set indeterminate to false
start animation
end tell
repeat 10 times
my resetMainBar()
tell progressBar2
if current value is 1.0 then
set indeterminate to false
start animation
end if
end tell
repeat 10 times
tell main bar to increment by 1
delay 1
end repeat
tell progressBar2 to increment by 1
end repeat
tell main bar to stop animation
tell progressBar2 to stop animation
quit -- This quits the SKProgressBar app, closing all Progress Bars
end tell
on resetMainBar()
tell application "SKProgressBar"
tell main bar
set maximum value to maxValue
set current value to currentValue
end tell
end tell
end resetMainBar
Model: 2019 iMac-27
Browser: Safari 537.36
Operating System: macOS 10.14
[Ann] Version 1.9, compiled for Intel and M1 (Universal)
@JMichaelTX. Sorry, I didn’t notice your post. Delete all old versions of SKProgressBar to avoid the terminology clash.
Hi Stefan,
trying to use SKProgressBar1.9 to display several progress bars about some nested processes for my scripts, I encounter a problem as soon as I try to add a 3rd progress bar. Working with a copy of your demo script, I get an AppleScript Execution Error saying “Erreur dans SKProgressBar : Le gestionnaire AppleEvent a échoué.” and a -10000 error code (errAEEventFailed) as soon as I reach the extra line
set progressBar3 to make new progress bar at after progress bar 2 with properties {header:"EXTRA Progress Bar #3"}
I’ve added after ‘CREATE & SETUP PROGRESS BAR #2’ block and before ‘DISPLAY/ACTIVATE THE PROGRESS BARS’ one.
Did I misunderstand that number of progress bars was potentially unlimited, and if not, do you have any idea of what is going wrong?
Thanks a lot.
Digging around encountered problem, I made some further tests. It is indeed possible to have more than 2 progress bars in window, but there’s definitely something weird around progress bar 2 when we try to have 3 or more of them.
This leads to a -1000 error
tell application "SKProgressBar"
set ProgressBar2 to make new progress bar at after progress bar 1 with properties {header:"2nd"} --> OK
set ProgressBar3 to make new progress bar at after progress bar 2 with properties {header:"3rd"} --> error -1000
end tell
While this executes without error
tell application "SKProgressBar"
set ProgressBar2 to make new progress bar at after progress bar 1 with properties {header:"2nd"} -- OK
set ProgressBar3 to make new progress bar at before progress bar 2 with properties {header:"3rd"} -- OK
-- set ProgressBar4 to make new progress bar at after progress bar 3 with properties {header:"4th"} --> error -1000
set ProgressBar4 to make new progress bar at after progress bar 2 with properties {header:"4th"} -- OK
set AllProgressBars to every progress bar
set show window to true
end tell
3 progress bars are created besides main, but both ProgressBar2 and ProgressBar3 have ‘progress bar 2’ object as value and window seems to display the 3 extra-bars as the same, all with ‘2nd header’. However
every progress bar
do return 4 different objects: main as progress bar 1, named ‘3rd’ as progress bar 2, named ‘4th’ as progress bar 3 and named ‘2nd’ as progress bar 4 (quite logical considering location set in make commands).
All that said, considering my need of 6 progress bars for 6 parallels processes, I’ve ended up with the following:
tell application "SKProgressBar"
repeat with i from 1 to 7
make new progress bar at after progress bar 1 with properties {header:"#"}
end repeat
set progress bar 1's header to "Bar 1"
set progress bar 2's header to "Bar 2" -- not displayed
set progress bar 3's header to "Bar 3"
set progress bar 4's header to "Bar 4"
set progress bar 5's header to "Bar 5"
set progress bar 6's header to "Bar 6"
set progress bar 7's header to "Bar 7"
set progress bar 8's header to "Bar 8" -- displayed twice
set show window to true
quit
end tell
I thought I would just have to do ‘delete progress bar 2’ and ‘delete bar 8’ to fall back on my feet, but it’s still not working properly: display is fine but tests proved we still need to address progress bars with their original index, so at the end the last bar is unusable.
I’d be grateful for any help or fix.
Thank you for your report. I will try to fix it.
Edit: I think I got it, stupid mistakes.
Minimum OS version is now 10.13, the app is code-signed and notarized.
Thanks a lot Stefan for the bugfix, now is working fine