SKProgressBar 1.0, a fully scriptable progress bar

I’m having some trouble now. I changed just a few things from my original script in order to make it work with the new changes. First I moved the “set image path” and “set header” elements into tell blocks for the main bar. Then I added a quit delay to the main tell for SKProgressBar. All that worked fine, the first time. After that the window pops up, the files transfer, but there is no bar displayed. Any thoughts as to why? All my previous “tell progress bar” blocks were correctly updated to “tell main bar” when I installed the new version.

I have also noticed that when I script in a quit command, it outputs this in the events:


tell application "SKProgressBar"
	quit
		--> error number 0
end tell

You should delete the old version, keeping both versions could cause interferences.

And add a launch command in the first application tell block

PS: I uploaded a new build (27) which fixes an auto layout issue.

Stefan,

Do you have a sample script that shows the commands for version 1.5? When I download version 1.5 and the SKProgresssBar_scripting.scpt from the .dmg file in the first message, and try to run the script under OS X 10.11, I get this error:

SKProgressBar got an error: Can’t set header to “header”

If I remove other lines, I get more errors.

Is there an updated script somewhere?

Thank you!

@Stefan: Thanks for the update.

I too would be interested in an updated example script illustrating the new features.

Does nobody read release notes ? :wink:

Since the new version can handle multiple bars, the properties header, header alignment, footer, footer alignment and image path have been moved to the progress bar class.

So replace progress bar with main bar and move the lines regarding the mentioned properties into the first tell main bar block.

New bars can be created and deleted with the standard make new and delete commands

This script is compatible with version 1.5

set iconPath to (path to applications folder as text) & "iTunes.app:Contents:Resources:iTunes.icns"

tell application "SKProgressBar"
	activate
	
	-- main window properties
	set floating to false --> default is true
	set position to {100, 100} --> default is {1000, 750}, origin point is bottom left
	set width to 600.0 --> default is 500.0
	set title to "myGreatTitle" --> default is "SKProgressBar"
	
	-- image path can be HFS or POSIX path, default is missing value (no image)
	
	tell main bar
		set minimum value to 0.0 --> default is 0.0
		set maximum value to 100.0 -->  default is 100.0
		set current value to 30.0 --> default is 0.0
		
		-- header / footer properties
		set header to "header" --> default is empty string
		set header alignment to right --> default is left
		set footer to "footer" --> default is empty string
		set footer alignment to center -->  default is left
		
		set image path to iconPath
		
	end tell
	
	set show window to true --> default is false
	tell main bar
		set indeterminate to false --> default is true
		
		start animation
		repeat 6 times
			increment by 10.0
			delay 1
		end repeat
		stop animation
		
	end tell
	quit
end tell

Thank you, Stefan! Is there any chance you might update your first post with the current script and with a new .dmg that contains the script and the application in one place?

Thanks again!

Yep, read the notes several times. But, FYI, they do not replace a good example script that includes the new features. It may be obvious to some, but not all, that the examples in the notes will not run standalone, they have to be integrated into a larger script.

Many thanks for this tool and the update.

I do have a few questions that your answers would be very helpful, when you find the time:

  1. What does start/stop animation do?
    ¢ I don’t see any change in behavior when I don’t use these commands.

  2. What does “indeterminate” mean, and what is the effect of setting it to true/false?

  3. Could you possibly give us some some control over the text size for the labels on the window/bars:
    ¢ window title
    ¢ header
    ¢ footer

I find the current label size to be very small, hard to read on some monitors/resolutions.
The ideal would be to let us set a point size for each.

  1. How do we effectively use multiple progress bars?
    ¢ Can each bar be run/updated asynchronously?
    ¢ Normally one would be in some loop performing some activity when you need to update the bar.
    ¢ I don’t see how to do this with two activities, two bars

  2. Can we use SKProgressBar app in two different scripts at the same time?
    ¢ Since your example quits the app, it would appear that other scripts might be prematurely stopped.

Thanks.

Here is an example script based on your script above, that adds some comments and tries to integrate a 2nd ProgressBar. All comments/suggestions for improvement much appreciated:

Animated GIF of ProgressBar 1.5 Script:


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.5" --> 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
	
	set oMainBar to main bar
	
	set currentValue to 0.0
	set maxValue to 100.0
	
	tell oMainBar --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 footer to "footer" --> default is empty string
		set footer alignment to center -->  default is left
		
		-- 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 oBar2 to make new progress bar ¬
		with properties {header:"TEST Progress Bar #2", header alignment:center}
	move oBar2 to end of progress bars
	
	## Don't know how to effectively use it.
	
	---------------------------------------------------
	--	DISPLAY/ACTIVATE ALL PROGRESS BARS --
	---------------------------------------------------
	--	This will show one window will all progress bars
	
	## How do we use/update other ProgressBars?
	
	set show window to true --> default is false
	
	tell oMainBar --main bar
		set indeterminate to false --> default is true
		
		--start animation		## What is the purpose of this?  I don't see any effect of using it.
		repeat with nInc from currentValue to maxValue by ((maxValue - currentValue) / 10)
			--increment by nInc --10.0
			set current value to nInc
			set footer to ((nInc as text) & " of " & maxValue as text)
			delay 0.5
		end repeat
		--stop animation
		
	end tell
	
	quit ### This quits the SKProgressBar app, closing all Progress Bars
	
end tell


Thank you for the animated GIF and the extended script.

Both start/stop animation and indeterminate refer to the appropriate API of NSProgressIndicator

From the documentation:

start / stop animation: Starts the animation of an indeterminate progress indicator.

indeterminate: A determinate indicator displays how much of the task has been completed. An indeterminate indicator shows simply that the application is busy.

The window title is standard Cocoa window title size and cannot be changed, the size of header and footer is the same as in a Finder progress bar window, but of course it is possible to add a property (or enumeration) to control the size

AppleScript does not work asynchronously, multiple bars can be used for example in nested repeat loops. This progress bar application is a simple wrapper for one or multiple standard Cocoa NSProgressIndicator in a window and provides AppleScript control of the main properties and commands like

¢ Set minimum, maximum and current value.
¢ Set the bar to determinate or indeterminate state.
¢ Start the animation.
¢ Increment the current value.
¢ Stop the animation.

I haven’t tested that, maybe it’s possible. But it’s not required to quit the app.

[ANN] SKProgressBar 1.6

Changes :

- Add: Changeable sizes of header and footer. Sizes are mini, small (default) and regular and correspond to the recommended Cocoa system sizes.

Example:
tell main bar to set header size to regular

- Add: The application is distributed in a code-signed .dmg including a demo script.

Download: SKProgressBar 1.6

Hi Stefan,

Thanks for useful SKProgressBar app.
I was searching for something like that for many years.

Even Apple’s new progress property does not give you many controls. The worst omission: no way to tell progress window to close unless you quit script.

I have an issue running SKProgress Bar 1.5 or 1.6 under 10.10.11 (El Capitan). I just can’t set the position of ProgressBar. I am able to get position , but not able to set. I then tied the demo script that came with the 1.6 version and realized it does not work too (changing the 100, 100 coordinates does not produce any changes). Bar window always shows up around center–> {472, 575} on a 1440 x 900 display.

It is just annoying since important functionalities are working just fine.

Jean.O.matiC

Oops, my bad.

Indeed the line to set the frame origin was missing.

It’s fixed in SKProgressBar 1.6.1

Thanks Stefan for super fast reply and reaction!
Sorry to say, version 1.6.1 does not run on El Capitan [Une erreur de type -10810 est survenue.].
An error of type -10810 has happened.
Same with demo script bundled with version 1.6 dmg.
Reverting to 1.6 for now, and works as expected, except for minor flaw.

Jean.O.matiC

Try to resolve the 10810 error with the suggestions in this article:

http://www.thexlab.com/faqs/error-10810.html

Stefan,
Thanks for the link, it was a long time since I browsed that site. Restarted Mac and did some testing. No Applications running but Script Editor, Finder, Quicktime (for video capture). Video was captured w/o sound to show script working with version 1.6, not working with 1.6.1 then working again with 1.6.
Simply said version 1.6.1 can’t launch on my Mac.
Mac OS X ElCapitan 10.11.6 [Build 15G1212]
https://youtu.be/zGQctJemb2o

Jean.O.matiC

Model: MacBook Pro 15 in. Late 2008
AppleScript: 2.5

It might be that I used the wrong option to sign the application.

I created a new build (40), re-checked the deployment target, archived the app using the correct option and made an disk image like the other versions.

It’s available at the same link.

Stefan, I must say I am very impressed!
Everything is OK now.
I can now save position of progress bar so it re-appears as it was placed on last run of script.

Thank you very, very much!

Best wishes for 2017,
Jean.O.matiC

[ANN] SKProgressBar 1.6.2

Changes :

  • Got rid of the last Carbon relict, the AppleScript point type which was mapped to old QuickDraw Point.
    In Swift this required a ObjC bridge header because Carbon Point is not available in Swift.
    Version 1.6.2 maps the point in the position property to NSValue.

  • Some minor optimizations.

Download: SKProgressBar 1.6.2

Hi Stefan!

The link to the latest version is broken.

http://www.klieme.com/Downloads/SKProgressBar/SKProgressBar1.6.2.zip
gives error 404.
Would be nice to have another link on the main page of your site [http://www.klieme.com].

Jean.O.matiC

I edited the post and fixed the link.

Hi all,
Is it possible to use SKProgressBar together with a shell script that uploads ONE file and see the uploading progress for this file ?


set shellscript to "curl -u " & ftp_name & ":" & ftp_pw & " -T " & thisPOSIXfile & " " & fileURL
do shell script shellscript

Thanks for your answers !