home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 53
/
Amiga_Dream_53.iso
/
Amiga
/
Applications
/
PAO
/
ExtensionsPageStream
/
DuplicateToPag.lha
/
DuplicateToPage.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1998-03-29
|
4KB
|
173 lines
/*
** -------------------------------------------
** $VER: DuplicateToPage V1.02 (29 Mar 1998)
** ⌐1997/98 Michael Merkel
** -------------------------------------------
**
** Usage:
**
** Just select the object(s) to duplicate.
** Than start ths script. Enter the page you want
** the object(s) to be copied and voila.
**
**
** Latest changes:
**
** - added comments and cleaned up code
** 1. READ THE CODE AND UNDERSTAND IT!
** 2. SIT DOWN AND DO SCRIPTS BY YOURSELF! IT IS EASY!
**
** - added a busy requester.
** operation can also be stoped now.
**
** - removed stupid screen refresh command at end.
** (so it's faster now)
**
** - Now works with more than one object!
** (thanks to Randall Blank for the report)
*/
pgsName = 'DuplicateToPage'
pgsVersion = 'V1.02'
pgsDate = '03/29/1998'
pgsCopy = '⌐1997/98 Michael Merkel'
OPTIONS RESULTS
/* Make sure rexx support is opened */
IF ~SHOW('L','rexxsupport.library') THEN
CALL ADDLIB('rexxsupport.library',0,-30)
IF ~SHOW('L','softlogik:libs/slarexxsupport.library') THEN
CALL ADDLIB('softlogik:libs/slarexxsupport.library',0,-30)
ADDRESS 'PAGESTREAM'
/*
** Get the number and IDs of all selected objects
*/
'GETSELECTEDOBJECTS IDLIST objNum'
idCount = RESULT
/*
** No object selected? -> error message and quit
*/
IF (RC > 0)
THEN DO
Call DoErrorRequester('No object(s) selected!')
Exit
END
/*
** remember the current page number
*/
'CURRENTPAGE'
page = RESULT
/*
** Ask user on which page the copies will go
*/
Call DoRequester
IF (ergebnis = cancelhandler)
THEN Exit
/*
** Open a busy requester and disable refreshing
*/
busyHandle = OpenBusy( 'Duplicating objects...', (idCount-1) )
'REFRESH OFF'
/*
** Run over all selected objects and duplicate them.
** Move the duplicates to the desired page.
** (Always update the busy requester)
*/
DO k=0 TO (idCount-1)
IF ( SetBusy(busyHandle, k) = 1 )
THEN Call CleanUp(busyHandle)
'DUPLICATE OFFSET "0" "0" OBJECTID "'objNum.k'"'
'MOVETOPAGE PAGE "'page'" OBJECTID "'objNum.k'"'
END
/*
** Close the busy requester and enable refresh.
*/
Call CleanUp(busyHandle)
DoRequester:
xWin = 400
yWin = 60
'ALLOCAREXXREQUESTER "'|| pgsName pgsVersion ||' ('|| pgsDate ||') - '|| pgsCopy ||'" '|| xWin yWin
reqHandle = RESULT
'ADDAREXXGADGET 'reqHandle' EXIT 10 '|| (yWin - 20) ||' 70 LABEL "_Ok"'
okHandler = RESULT
'ADDAREXXGADGET 'reqHandle' EXIT '|| (xWin - 80) (yWin - 20) ||' 70 LABEL "_Cancel"'
cancelHandler = RESULT
'ADDAREXXGADGET 'reqhandle' STRING 200 10 80 STRING "'page'" LABEL "Duplicate to which page:"'
page_gadget = RESULT
'DOAREXXREQUESTER 'reqhandle
ergebnis = RESULT
'GETAREXXGADGET 'reqhandle' 'page_gadget' STRING'
page = RESULT
'FREEAREXXREQUESTER 'reqhandle
Return
DoErrorRequester:
PARSE ARG text
xSize = Length(text) * 8
'ALLOCAREXXREQUESTER "'pgsName pgsVersion'" '|| (xSize+20) ||' 50'
reqHandle = RESULT
'ADDAREXXGADGET 'reqHandle' EXIT '|| (xSize/2+10-35) ||' 30 70 LABEL "_Ok"'
dummy = RESULT
'ADDAREXXGADGET 'reqHandle' TEXT 10 10 '|| xSize ||' STRING "'|| text ||'"'
'DOAREXXREQUESTER 'reqHandle
dummy = RESULT
'FREEAREXXREQUESTER 'reqHandle
Return
OpenBusy:
PARSE ARG title,total
'OPENBUSYREQUESTER MESSAGE "'title'" THERMOMETER ENABLED ABORT ENABLED TOTAL 'total' CURRENT 0'
ret = RESULT
Return ret
SetBusy:
PARSE ARG reqNum,value
IF (reqNum > 0)
THEN DO
'SETBUSYREQUESTER '|| reqNum ||' CURRENT '|| value ||''
'GETBUSYREQUESTER '|| reqNum
ret = RESULT
END
ELSE ret = 0
Return ret
CleanUp:
PARSE ARG reqNum
IF (reqNum > 0)
THEN 'CLOSEBUSYREQUESTER '|| reqNum ||''
'REFRESH ON'
Exit