How do I place progress bars into my script

I would like to show the progress of my script which takes a bit of time to run. That way the person waiting knows something is happening.

Is there a way to incorporate the “Progress/Time remaining” bar to show how much time is actually remaining? I can use the 24U Appearance OSAX for a predetermined amount of time but can not modify it to show me actual time.

Thank you,

Steven.

You can do a “more-or-less” calculation using a timer in a text field:

set number_of_rounds to 100

set average to {}

repeat with i from 1 to number_of_rounds
	set x to (current date) --> eg, first round
	
	delay 2 --> do some stuff, aproximatelly takes 2 seconds
	
	set end of average to (current date) - x --> how many time take a round?
	--> calculate average
	set seconds_round to 0
	repeat with x in average
		set seconds_round to seconds_round + x
	end repeat
	set seconds_round to seconds_round / (average's length)
	
	set seconds_remaining to (number_of_rounds - i) * seconds_round
	--> format seconds to min:secs, update progress bar and text field
end repeat

If you need more precission (eg, one round takes 0.28 seconds), you can substitute “current date” for “the ticks” (1 tick = 1/60 seconds), Jon’s Commands, or whatever substitute.

Thank you,

I’ll give that a try when the schedule allows.

Steven.