Re: status display
Re: status display
- Subject: Re: status display
- From: Paul Skinner <email@hidden>
- Date: Fri, 28 Sep 2001 10:32:17 -0400
on 9/28/01 4:13 AM, Harald E Brandt wrote:
>
+--> Andrew Simpson wrote 01-09-18:
>
> anyone have an idea of how to display status in a processing script.
>
+-
>
>
Here's a miniature "review" I wrote some months ago:
>
>
1. For the progress thing I tried Progress Bar, Akua Sweets (display
>
progress), and lastly Dialog Director.
>
>
-- The simplest thing is the 68k application Progress Bar, but it *really*
>
looks old! And it really is: --from november 1993!! Oh dear! It requires
>
several lines of nested tell code (2 tell levels deep) and is therefore not at
>
all succinct. It is free, but not for companies selling software and who also
>
wants to use this app as part of the package.
SNIP
For those who still use ProgressBar you can try a handler I wrote to deal
with all the fuss of calling Progress bar and updating it.
Drop a call into your repeat loop like so...
repeat with thisLoop from 1 to 100
progressBar({maxValue:100, curValue:thisLoop})
end
Or if you want more feedback you can use optional parameters in the call
like so...
repeat with thisLoop from 1 to 100
progressBar({maxValue:100, curValue:thisLoop, minValue:1, barName:"barName",
barCaption:"barCaption", barSubCaption:"barSubCaption."})
end
That's a lot better. I wish that this was just part of AppleScript. Progress
bars, output windows, UI stuff like that. Oh, wait, It will be when we get
AppleScript Studio! Yippee! ( dancing around the office being thought insane
by coworkers. Can't explain it to 'em . Just makes 'em think your crazy and
geeky. )
Here's the handler. Wraps like Snoop Doggy Dogg.
--Begin handler
progressBar({maxValue:100, curValue:50, minValue:1, barName:"barName",
barCaption:"barCaption", barSubCaption:"barSubCaption."})
on progressBar(parameters)
--progressBar( {maxValue:maxValue, curValue:curValue, minValue:1,
barName:"barName", barCaption:"barCaption", barSubCaption:"barSubCaption."})
------------------------------------------------------------------
try --to get the current value
set curValue to curValue of parameters
set maxValue to maxValue of parameters
on error
tell application "Progress Bar 1.0.1"
quit
end tell
return false
end try
--------------------------------------------------------
try
set barName to barName of parameters
try
set barCaption to barCaption of parameters
try
set barSubCaption to barSubCaption of parameters
on error
set barSubCaption to "items."
end try
on error
set barCaption to "Currently Processing"
set barSubCaption to "items."
end try
on error
set barName to "Script Progress"
set barCaption to "Currently Processing"
set barSubCaption to "items."
end try
------------------------------------------------------------
--test for this bar's existence. Otherwise make it.
try
--Advance the progress bar
tell application "Progress Bar 1.0.1"
--activate
set barReference to a reference to progress bar 1 of window
barName
tell barReference
set subcaption to ((curValue as text) & " of " & (maxValue
as text) & " " & barSubCaption)
set current value to curValue
end tell
end tell
on error
--Make the necessary window.
try
set maxValue to maxValue of parameters
tell application "Progress Bar 1.0.1"
activate
make new window with properties {Name:barName,
Position:{400, 300}}
set barReference to a reference to progress bar 1 of window
barName
tell barReference
set minimum value to 1
set current value to curValue
set maximum value to maxValue
set caption to barCaption
set subcaption to barSubCaption
end tell
end tell
on error
return false
end try
end try
----------
if curValue is maxValue then
tell application "Progress Bar 1.0.1"
quit
end tell
end if
-----------------------------------------
end progressBar
--end handler
--
Paul Skinner