home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
viscobv7.zip
/
vac22os2
/
ibmcobol
/
macros
/
repeats.lx
< prev
next >
Wrap
Text File
|
1998-02-24
|
1KB
|
38 lines
/* This macro repeats a command a given number of times */
/* Two dialogs are issued - the first collects the number */
/* the second the command to repeat */
/* Note: if a number is not entered the macro ends and a message is issued */
/* Note: only valid editor commands are accepted on the second dialog */
'set lineread.title Repeat a Command'
'set lineread.prompt Enter the number of time to repeat:'
'lineread 255'
'extract lastkey'
if lastkey = 'ENTER' then do
'extract lastline'
end
if datatype(lastline) = NUM /* check that a number was entered */
then do
numrep = lastline
end
else do
MSG 'You must enter a valid number'
return
end
/* get the second piece of information */
'set lineread.title Repeat a Command'
'set lineread.prompt Enter the command to repeat:'
'lineread 255'
'extract lastkey'
if lastkey = 'ENTER' then do
'extract lastline'
end
cmd_rep = lastline
/* substitute the values entered and run repeat command */
'repeat' numrep cmd_rep