Menu

#190 ARexx - show "work in progress"

open
nobody
None
2
2014-08-14
2009-09-04
AmigaPhil
No

Something to notify from ARexx that a "work is in progress" would be
welcome. The suggested APPBUSY and APPNOBUSY can do that, and that's
already enought. But a progress requester ala Thor would be nicer.
This is just a suggestion, I reckon it is more complex to implement;
so consider it with a low priority.

Here is an example of how the use a progress requester with Thor :
(details of the commands, taken from Thor's guide, below)

/* example */

OPTIONS RESULTS
ADDRESS(THOR.01)

'OPENPROGRESS TITLE "Work in progress..." TOTAL 100 AT "_Abort"'
window = result
DO i=1 TO 100
'UPDATEPROGRESS REQ 'window' CURRENT 'i' PT "Busy on item #'i'"'
/* do something else here */
END
'CLOSEPROGRESS REQ 'window
exit

(Attached is a snapshot of the requester (ClassAct) )

AmigaPhil

-----
(from Thor's guide)

NAME
OPENPROGRESS -- Open a window with a progressbar

SYNOPSIS
OPENPROGRESS TITLE/A,TOTAL/N,ABORTTEXT=AT
PROGRESSTEXT=PT,PROGRESSCHARWIDTH=PCW/N

FUNCTION
This function will open a window with a progressbar, an optional
abort-gadget (with selectable text) and a text information field.

INPUTS
TITLE/A - Required title text for the progress window
TOTAL/N - Total number of levels in the progressbar. Defaults to 100.
ABORTTEXT - The text in abort gadget. '_' infront of a character will
make that character the keyboard shortcut. If this argument is not
supplied, no gadget will be created and the user can not abort the
progress window.
PROGRESSTEXT - Text to be shown over the progress bar.
PROGRESSCHARWIDTH - Optional width of progressbar in characters.
Will default to the number of characters supplied in PROGRESSTEXT.

RESULT
0 - success, in which case result will contain a number that *must*
be supplied to UPDATEPROGRESS and CLOSEPROGRESS in the REQ
parameter.
30 - failure

EXAMPLE
See UPDATEPROGRESS for detailed example.

NOTES
New for THOR 2.0

Make sure the number in result remains unchanged and pass this
number to CLOSEPROGRESS and UPDATEPROGRESS without modification.
If modified, nasty things will surely happen.

The use of ARexx `on error' is strongly recommended.

-----

NAME
UPDATEPROGRESS -- Update a progressbar opened with OPENPROGRESS

SYNOPSIS
UPDATEPROGRESS REQ/N/A,CURRENT/N,TOTAL/N,PROGRESSTEXT=PT

FUNCTION
This function will update a progressbar window.

INPUTS
REQ/N/A - The number returned in result from OPENPROGRESS.
CURRENT/N - Change the current level of the progressbar
TOTAL/N - The progressbar will be reset to it's initial state if
this argument is provided with a total value.
PROGRESSTEXT - Text to be shown over the progress bar.

RESULT
0 - success
5 - The user has pressed the abort gadget and your ARexx script
should close the progress window with CLOSEPROGRESS and
abort. It is your responsibility to check this and stop
your ARexx script.
30 - failure

EXAMPLE

OPENPROGRESS TITLE '"Progress Test"' AT '"_Abort"' PCW 30
if(rc = 0) then
do
window = result /* Important !!! */

do i=1 to BBSLIST.COUNT
/* Display bbsname and reset progressbar.*/
UPDATEPROGRESS REQ window TOTAL 50 CURRENT 1 PT '"'BBSLIST.i'"'
do n=1 to 50
/* Update progressbar 50 times for each bbs */
UPDATEPROGRESS REQ window CURRENT n
/* Check if user aborted */
if(rc ~= 0) then do
CLOSEPROGRESS REQ window
exit
end
end
end
end

-----

NAME
CLOSEPROGRESS -- Close a progress bar window

SYNOPSIS
CLOSEPROGRESS REQ/N/A

FUNCTION
Close a progress bar window that was opened with OPENPROGRESS.

INPUTS
REQ/N/A - The number returned in result from OPENPROGRESS *must*
be supplied to this function.

RESULT
0 - success
30 - failure

Discussion

  • AmigaPhil

    AmigaPhil - 2009-09-04

    Snapshot of Thor's progress requester

     
  • AmigaPhil

    AmigaPhil - 2009-09-04
    • priority: 5 --> 2
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.