home *** CD-ROM | disk | FTP | other *** search
- /* K.A.Ash (c) Copyright 1996 */
- /* install.cmd */
- /* ----------- */
- /* A very simple installation script. */
-
- options etmode
- options exmode
- call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
- call SysLoadFuncs
-
- programName = SysSearchPath('PATH', 'TaskBox.exe')
- if programName = '' then
- do
- say 'Error: Could not find TaskBox.exe in PATH directories.'
- exit
- end
-
- if stream('TaskBox.dll', 'command', 'query exists') = '' then
- do
- say 'Error: Could not find TaskBox.dll in the current directory.'
- exit 1
- end
-
- DEST=''
- do while DEST=''
- DEST = GetAnswer( "<WP_DESKTOP>", "Enter directory to install TaskBox objects" )
- /* make dir fully qualified */
- if( SubStr( DEST,1,1) \= '<' & SubStr( DEST,2,2)\=':\' ) then do
- DEST = GetFullQualifiedPath( DEST )
- end
-
- /* should check if destination is valid dir */
- if( DEST = '' ) then Say "Invalid directory selected"
- end /* do while */
-
- if SysCreateObject('WPProgram', 'TaskBox', DEST,,
- 'EXENAME='programName';STARTUPDIR='directory() || ,
- ';PROGTYPE=PM;OBJECTID=<TaskBox>;PARAMETERS=/WATCH 20 /P:F:0%',,
- 'u') = 0 then
- say 'Error: Could not create object.'
- else
- say 'The program object was successfully created in 'DEST
-
- CALL inst_modules
-
- if SysSearchPath('PATH', 'e.exe') \='' then
- do
- ANS = SubStr( GetAnswer( "Y", "View TaskBox.txt now(Y/N) ?" ), 1, 1)
- if ( (ANS = 'Y') | (ANS = 'y') ) then
- "e.exe TaskBox.txt"
- end
- exit
-
- exit 0
-
- inst_modules:
-
- IF SysFileTree( "module.1st", "file", "FOS" ) THEN DO
- SAY 'Error: SysFileTree failed'
- RETURN
- END
-
- DO i = 1 to file.0
- j = LASTPOS( '\', file.i )
- IF j ¬= 0 THEN j = j - 1
- CALL do_module SUBSTR( file.i, 1, j )
- END
-
- RETURN
-
- do_module: /* arg directory containing module.1st */
- ARG dir
- file = dir||'\module.1st'
- module = LINEIN( file )
- DO WHILE LINES( file )
- line =LINEIN( file )
- IF line = "COMMAND:" THEN LEAVE
- SAY line
- END
-
- Say 'Do you wish to install "'module'"(Yes/No) ?'
- PULL ans .
- IF SUBSTR(ans,1,1) = 'Y' THEN DO
- '@copy 'dir||'\'||module' . '
- IF rc = 0 THEN
- IF line = 'COMMAND:' THEN DO
- cur_dir = DIRECTORY()
- CALL DIRECTORY( dir )
- DO WHILE LINES( file )
- cmd = LINEIN( file )
- INTERPRET cmd
- END
- CALL DIRECTORY( cur_dir )
- END
- IF rc = 0 THEN SAY module' installed.'
- ELSE SAY 'Failed to install 'module
- END
- ELSE
- SAY 'Skiping this "'module'"'
- RETURN
-
- GetAnswer:
- parse arg DEFAULT, MSG
-
- say;
- call Charout, MSG '['DEFAULT'] : ';
- parse pull ANS;
- if (Length(ANS) > 0) then
- return(ANS);
- else
- return(DEFAULT);
-
- GetFullQualifiedPath:
- parse arg SRC
- DEST = ''
- if( SubStr( SRC,2,1) = ':' ) then do
- CURDIR = Directory()
- NEWDIR = Directory( SubStr(SRC,1,2) )
- if( Length( NEWDIR) = 3 & SubStr( NEWDIR,3,1) = '\' ) then
- NEWDIR = SubStr( NEWDIR, 1,2 )
- if( NEWDIR \= '' ) then do
- DEST = NEWDIR'\'SubStr( SRC,3)
- end /* Do */
- call Directory CURDIR
- end /* Do */
- else do
- DIR = Directory()
- if( Length( DIR) = 3 & SubStr( DIR,3,1) = '\' ) then
- DIR = SubStr( DIR, 1,2 )
- DEST = DIR'\'SRC
- end /* Do */
- return (DEST)
-