home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: WPS_PM / WPS_PM.zip / wire1_01.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1995-12-25  |  3KB  |  143 lines

  1. /* Wiresave Install Utility */
  2.  
  3. call rxfuncadd 'sysloadfuncs', 'rexxutil', 'sysloadfuncs'
  4. call sysloadfuncs
  5.  
  6. cls
  7.  
  8. ver = SysOS2Ver()
  9.  
  10. if ( ver < 2.3 ) then
  11. do
  12.    say "This program will not run on OS/2 versions previous to"
  13.    say "Warp 3.0.  Why aren't you Warped?"
  14.    exit 1
  15. end
  16.  
  17. say "Please enter the fully qualified directory to store the program"
  18. say "files.  Default is C:\UTILS\WIRESAVE."
  19. say "ex: C:\UTILS\WIRESAVE"
  20. say ""
  21.  
  22. parse pull inDir
  23.  
  24. if ( length( inDir ) = 0 ) then
  25.    inDir = "C:\UTILS\WIRESAVE"
  26.  
  27. if ( right( inDir, 1 ) = "\" ) then
  28.    inDir = LEFT( inDir, length( inDir ) - 1 )
  29.  
  30. fileRC = sysfiletree( inDir, retStem, 'D' )
  31.  
  32. if ( rc > 0 ) then
  33. do
  34.    say "Error calling sysfiletree(), rc =" fileRC
  35.    exit 1
  36. end
  37.  
  38. if ( retStem.0 < 1 ) then
  39. do
  40.    say "Directory" inDir "not found. Create it (Y/n)?"
  41.    pull answer
  42.  
  43.    if ( pos( "N", answer ) > 0 ) then
  44.    do
  45.       say "Installation aborted."
  46.       exit 1
  47.    end
  48.    else
  49.    do
  50.       if ( pos( "\", inDir, 3 ) = 0 ) then
  51.       do
  52.          say "Invalid directory entered. Installation aborted."
  53.          exit 1
  54.       end
  55.  
  56.       if ( pos( "\\", inDir ) > 0 ) then
  57.       do
  58.          say "Invalid directory entered. Installation aborted."
  59.          exit 1
  60.       end
  61.  
  62.       endPos = 4
  63.  
  64.       do until endPos = 0
  65.          endPos = pos( "\", inDir, endPos + 1 )
  66.          if endPos = 0 then
  67.             dirPath = inDir
  68.          else
  69.             dirPath = left( inDir, endPos - 1 )
  70.  
  71.          makeRC = sysMkDir( dirPath )
  72.       end
  73.  
  74.    end
  75. end
  76.  
  77. copyDir = '"' || inDir || '"'
  78.  
  79. copy "*.*" copyDir
  80.  
  81. if ( rc > 0 ) then
  82. do
  83.    say "Error copying files to directory" inDir
  84.    exit 1
  85. end
  86.  
  87.  
  88. if syscreateobject( "WPFolder", "Wiresave", "<WP_DESKTOP>",,
  89.                     "OBJECTID=<MYFOLDER>", "R" ) then
  90. do
  91.    if syscreateobject( "WPProgram", "Wiresave", "<MYFOLDER>",,
  92.                        "OBJECTID=<MYSAVER>;EXENAME=" || inDir || "\SAVER.EXE;STARTUPDIR=" || inDir,,
  93.                        "R" )  then
  94.    do
  95.       keyline = "EXENAME=" || inDir || "\SAVEEDIT.EXE;STARTUPDIR=" || inDir
  96.       say keyline
  97.       if syscreateobject( "WPProgram", "Wiresave Editor", "<MYFOLDER>",,
  98.                           keyline, "R" )  = 0 then
  99.       do
  100.          say "Error creating object for SAVER.EXE"
  101.          exit 1
  102.       end
  103.    end
  104.    else
  105.    do
  106.       say "Error creating object for SAVEEDIT.EXE"
  107.       exit 1
  108.    end
  109. end
  110. else
  111. do
  112.    say "Error creating desktop folder!"
  113.    exit 1
  114. end
  115.  
  116. cls
  117.  
  118. say "If you want to use Wiresave daily, it is best to have a shadow of Wiresave"
  119. say "placed in your Startup."
  120. say "Do you wish to have Wiresave placed in your Startup folder (y/N)?"
  121.  
  122. pull answer
  123.  
  124. if ( pos( "Y", answer ) > 0 ) then
  125. do
  126.    say "Creating Shadow"
  127.    if syscreateshadow( "<MYSAVER>", "<WP_START>" ) = 0 then
  128.    do
  129.       say "Error creating shadow of SAVER.EXE in Startup folder"
  130.       exit 1
  131.    end
  132. end
  133.  
  134. say
  135. say
  136. say "Wiresave installed successfully. Look for the Wiresave folder on"
  137. say "your desktop."
  138. say
  139. say "Please read the file: readme.txt for tips on making Wiresave work"
  140. say "best on your computer."
  141.  
  142. exit 0
  143.