home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 30 fixes_v
/
30-fixes_v.zip
/
p21sp.zip
/
DESKSAVE.CMD
next >
Wrap
OS/2 REXX Batch file
|
1994-06-07
|
11KB
|
383 lines
/* Save Desktop Directory & INIs*/
/*Copyright (c) 1993 CLEAR & SIMPLE, INC.*/
Arg toDrive
ECHO OFF
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
if todrive\='' then do;
call GetBoot
call initvariables
dialog=0
signal NoDialog
end /* Do */
dialog=1
'mode co80,28'
objectName='D E S K S A V E . C M D'
progid='DESKSAVE.CMD'
call source
call initVariables
call welcome
'cls'
pos=SysCurPos(0,0)
say 'DESKSAVE will save the WorkPlace Shell desktop settings to a diskette.'
say;say ' This will save the way your desktop looks right now!'
say ' Including Shadow, Folder and Template object settings';say' and where they are located on your desktop.'
say;say;
say 'Technically speaking it will save:'
say;SAY GREEN;say ' 1.) The DESKTOP Directory and its sub-directories'
say ' 2.) OS2.INI and OS2SYS.INI'
say ' 3.) Config.sys '
say;say;SAY BLUE; Say 'Label the diskette';
msg.0=9
msg.1= black
msg.2= cr5 ' ┌─────────────────────┐'
msg.3= cr5 ' │ WorkPlace Shell │ '
msg.4= cr5 ' │ DESKTOP SETTINGS │'
msg.5= cr5 ' │ SAVED │ '
msg.6= cr5 ' │ │'
msg.7= cr5 ' │ (today''s date) │'
msg.8= cr5 ' └─────────────────────┘'
msg.9= blue
do i =1 to msg.0
say msg.i
end
say '';SAY GREEN;SAY'';SAY BLUE;
say 'You will need a formatted, diskette.'
say ' (You may also save to a non-boot fixed disk partition)'
pos=SysCurPos(25,0)
SAY;SAY RED;say 'Do you wish to continue? (Y/N) ';SAY BLUE
pos=SysCurPos(27,0)
parse upper pull ans1 .
if ans1 \= 'Y' then do
say 'We will not save the DESKTOP SETTINGS now!'
say ' '; say 'Press Enter to End'; pull
exit
end
else NOP
todrive = ' '
CALL getBOOT
say ' '
say 'First, I need some information from you!'
say;
answer = 'N'
do While answer \= 'Y'
say green;say ' Please enter the diskette/fixed disk drive letter (and directory)'
SAY '(e.g., "A:" or "B:" or D:\DESKSAVE ) '
say ' where you want me to place the backup information.'
say ' (or just press Enter for the default of "A:"):'
pull todrive
if todrive = ' ' then todrive = 'A:'
if length(todrive)=1 then todrive=todrive':'
say;say 'You entered - 'todrive;say 'Is this correct? (Y/N)'
pull answer
end
note.1 = 262
note.2 = 423
note.3 = 262
note.4 = 423
if todrive='A:' | todrive='B:' then do
do i=1 to 4
call beep note.i,75
end
say red;SAY 'Please insert the DESKTOP SAVE diskette into drive 'todrive
'PAUSE'
end
'cls'
NoDialog:
toDrive=toDrive'\P21DSAVE'
call finddesk
call elimdir todrive
parse var todrive drivlet ':' rest
drivlet=drivlet':'
call szdisk drivlet
parse var result tofree .
call howbig driveis'\'desktop
parse var result desksize NumberOfFiles
if desksize > tofree then do
'cls'
say;say;say;say ' Your Desktop total size is 'desksize 'bytes'
say ' The drive - 'drivlet' has only 'tofree' bytes free'
say; say red; say ' EITHER REDUCE THE SIZE OF YOUR DESKTOP'
say ' or'
say ' Direct the DESKSAVE operation to a larger DISK,'
say ' diskette, or drive partition.'
say;say blue; say 'Press Enter to End'
pull
exit
end
DIR20or21=DESKTOP
RC=SysFileTree(driveis'\'DIR20or21'\*.*', 'deskdirs', 'SDO')
if dialog then do;say blue; say "Now creating a new backup of your desktop!"
say blue; say '...'desktop ' now being copied';end
directorywithblanks='"'driveis'\'dir20or21'\*.*"'
'xcopy' directorywithblanks todrive'\dsk21sav\*.* /E/O >NUL'
restore.0 ='%1\os2\Xcopy 'todrive'\DSK21SAV\*.*' directorywithblanks' /E/O'
do k=1 to deskdirs.0
directorywithblanks='"'deskdirs.k'\*.*"'
'xcopy ' directorywithblanks todrive'\DK21'k'\*.* /E/O >NUL'
restore.k='%1\os2\Xcopy 'todrive'\DK21'k'\*.*' directorywithblanks' /E/O'
end
if dialog then do; say red;say '...the .INI files are now being copied';end
"xcopy " driveis"\OS2\OS2*.INI" todrive '/t/h/o >NUL'
if dialog then do; say green; say '...Config.sys is now being copied';end
"copy " driveis"\CONFIG.SYS" TODRIVE"\ORIGINAL.SYS" '>NUL'
call SysFileDelete todrive'\deskrstr.cmd'
OUTFILE = TODRIVE'\DESKRSTR.CMD'
call lineout outfile,'rem'
call lineout outfile,'rem The format is: deskrstr c:'
call lineout outfile,'rem Where c: is the OS/2 Drive to receive the following files:'
call lineout outfile,'rem \OS2\OS2.INI - \OS2\OS2SYS.INI - and the DESKTOP directory'
call lineout outfile,'rem There are several directories that have 0 files'
call lineout outfile,'rem The restore is copying the Extended Attributes of those directories.'
call lineout outfile,'xcopy OS2.INI %1\OS2\OS2.INI /t/h/o'
call lineout outfile,'xcopy OS2SYS.INI %1\OS2\OS2SYS.INI /t/h/o'
call lineout outfile,restore.0
do i = 1 to deskdirs.0
call lineout outfile,restore.i
end
if dialog then do; say blue;say
Say 'You just saved a copy of your Workplace Shell Desktop'
Say ' To restore this copy you must boot OS/2 from a diskette'
Say ' You may use the OS/2 Install Diskette & OS/2 Diskette #1'
Say " or a diskette made from Performance 2.1's OS2BOOT."
say;
say ' After the diskette boot change to drive & directory'
say red;say;say ' 'todrive
say;say blue;say ' Then enter DESKRSTR c:'
say; say ' where c: is your OS/2 Boot Drive'
say;say red; say 'Press Enter to end.'
pull; end
exit
elimdir:
arg deaddir .
newdir=RXQUEUE("Create", 'elimdirQ')
rc=RXQUEUE("Set", 'elimdirQ')
do queued()
pull
end /* do */
dirs.0=0
rc=SysFileTree(deaddir'\*.*',dirs,'BS', '*****', '-----')
if dirs.0=0 then do; RC=RXQUEUE('Delete', 'elimdirQ'); return; end
if dialog then do; say red; say "Now deleting the old saved desktop!";end
do i=1 to dirs.0
parse var dirs.i day time size att file
push att file;
end
do Queued()
pull att file;
if pos('D', att) = 2 then 'RD' file
else 'del' file '/N'
end
'RD' DEADDIR
RC=RXQUEUE('Delete', newdir)
return
finddesk:
ctr=0
rc=SysFileTree(Driveis'\*.*',dirs,'D')
do i=1 to dirs.0
parse upper var dirs.i date time . . directory
directory=strip(directory,'L')
parse var directory driv'\' dname
parse var dname first rest
If left(first,3) = 'OS!' | left(first,7) = 'DESKTOP' then do;
ctr=ctr+1
found.ctr=dname
birthdate.ctr=date '-' time
end
else nop
end
if ctr=1 then do; desktop=found.ctr; end
else call multidesk
return
multidesk:
say 'There are multiple directories that seem to be desktops on your boot drive'
say 'Their names are:'
say '# Directory ';say red
do j=1 to ctr
say j ' ' driveis'\'found.j ' Created Date/Time - 'birthdate.j
end
say blue;say 'Please specify which is your current desktop by entering the number'
say ' that precedes the correct desktop name. e.g. 1 2 3 '
pull numb
say 'The desktop you have chosen is 'found.numb
say ' If this is not correct then cancel this program (ctrl-break) and restart '
say ' '
say;say ' Press Enter to continue...'
pull
desktop=found.numb
return
howbig:
arg hbdir
newq= RXQUEUE('create')
oq=RXQUEUE('Set', newq)
hbtot=0;hbfilect=0
'Dir ' hbdir '/s/n/o:-d | rxqueue 'newq
do until queued() = 0
entry=lineIN('Queue:')
parse var entry filedate ftime fsize easize name
name=strip(name,L)
fmo='';fday='';fyr='';
parse upper var filedate fmo '-' fday '-' fyr;
if fyr ='' then do;
if translate(filedate)='DIRECTORY' then hbdir=fsize
iterate
end
if fyr \='' then do;
if datatype(fsize,N) then do;
hbtot=hbtot+fsize+easize;
hbfilect=hbfilect+1
dirs.hbfilect='"'hbdir'\'name'"'
filename.hbfilect=name;
filesize.hbfilect=fsize+easize
end
else hbtot=hbtot+easize
end
else call dirsearch
end
rc=rxqueue('delete', newQ)
dirs.0=hbfilect
return hbtot hbfilect
dirsearch:
do until strip(filedate)='DIRECTORY' | queued()=0
entry=lineIN('Queue:')
parse upper var entry filedate ftime fsize easize name;
if strip(filedate)='DIRECTORY' then hbdir=fsize
end
return
source:
parse upper source where
parse var where . . yes'\DESKSAVE.CMD'
rc=SysFileTree(yes'\MAP.CMD', stem, F)
if stem.0=0 then DO;
SAY 'This program has been modified to ONLY execute from the same'
say 'location where the entire Performance 2.1 PLUS product is installed.'
say 'We created this inconvience so that we could make it more '
say 'convienient to distribute this update over CompuServe.'
say;say 'Please copy this program 'progid 'to the correct drive'
say 'and directory where Performance 2.1 PLUS is installed, \PERF21 '
say '- so that it will properly execute.'
say; say 'If you do not have Performance 2.1 PLUS you may '
say 'purchase it from several stores that carry OS/2 Software. '
say 'You can also call Clear & Simple, Inc. at 203-658-1204, '
say 'or Fax (203) 651-0354, we accept VISA, MC or Discover credit cards.'
say;say 'The price of Performance 2.1 PLUS is only $39.95 '
say '- it includes a 100 page book dedicated to tuning your OS/2 system,'
say 'and 40 REXX utility programs that simplify the tuning process'
say 'and provide additional utility functions like backing-up your desktop'
say 'or making a single OS/2 Boot Diskette, etc.'
say;say 'Press enter to end.'
pull
exit
end
return
getBOOT:
bootdrive = Value('Path',,'OS2ENVIRONMENT')
parse upper var bootdrive bootdrive
Driveis = Substr(bootdrive,Pos('\OS2\SYSTEM',bootdrive)-2,2)
return
Welcome:
echo on
'prompt $p$E[0;'34';'47';'5';'5'm]'
echo off
'cls'
call SysCurState 'OFF'
call sysCurPos '4', '0'
msg.0 =12
msg.1 = blue
msg.2 = cr5 cr5' ┌────────────────────────────────┐'
msg.3 = cr5 cr5' │ │ '
msg.4 = cr5 cr5' │ P E R F O R M A N C E 2.1 │'
msg.5 = cr5 cr5' │ │ '
msg.6 = cr5 cr5' │ │'
msg.7 = cr5 cr5' │ │'
msg.8 = cr5 cr5' │ │'
msg.9 = cr5 cr5' │ │'
msg.10 = cr5 cr5' └────────────────────────────────┘'
msg.11 = hblue
msg.12 = cr5 ' Copyright (c) 1993 Clear & Simple, Inc. '
do i =1 to msg.0
say msg.i
end
call SysCurPos '19','0'
say red;
call sysCurPos '7', '22'
call syssay '────────────────────────────'
call sysCurPos '8', '21'
call syssay '─────────────────────────────'
say;
say red;
call sysCurPos '9', '21'
call syssay 'Go'
call sysCurPos '9', '23'
call syssay ' as fast as'
call sysCurPos '9', '35'
call syssay '32 bits'
call sysCurPos '11', '30'
call syssay ' will'
call sysCurPos '11', '35'
call syssay ' take'
say blue;
call sysCurPos '11', '41'
call syssay 'you!'
say hblack;
call sysCurPos '15', '0'
SAY' Please Maximize SCREEN SIZE & Press Enter to Continue...'
say red;
call sysCurPos '14', '26'
CALL SYSPAUSE ObjectName
call SysCurState 'ON'
'cls'
echo on
'prompt $p$E[0;'34';'47';'5';'5'm]'
echo off
'cls'
return
InitVariables:
black ='
A'
red ='
A'
green ='
A'
blue ='
A'
hblack ='
A'
hblue ='
A'
cr5 ='C'
return
SysPause:
parse arg prompt
call SysSay prompt
pos=SysCurPos(0,0)
Pull .
say
return
SysSay:
parse arg string
call charout 'STDOUT', string
return