home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / FILEMAN / PC2_180 / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1995-01-01  |  42KB  |  939 lines

  1. /***********************************************************************\
  2.  *                                 PC2.c                               *
  3.  *          Copyright (C) by Stangl Roman, 1993, 1994, 1995            *
  4.  *                                                                     *
  5.  * This Code may be freely distributed, provided the Copyright isn't   *
  6.  * removed.                                                            *
  7.  *                                                                     *
  8.  * Install.cmd  Installation batch file.                               *
  9.  *                                                                     *
  10. \***********************************************************************/
  11.  
  12. /* static char RCSID[]="@(#) $Header: Install.cmd Version 1.80 01,1995 $ (LBL)" */
  13.  
  14.                                         /* Register REXX APIs */
  15. Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  16. Call SysLoadFuncs
  17.  
  18. Call On Halt Name SignalHandler         /* CTRL+BREAK signal handler that just ignores any
  19.                                            CTRL+BREAK signal */
  20.  
  21.  
  22.                                         /* Get optional commandline parameters */
  23. Parse Upper Arg Arg1 Arg2 Arg3 Arg4 Arg5 .
  24.                                         /* Get the full qualified path of our installation
  25.                                            we are running now */
  26. Parse Upper Source . . InstallationFileName
  27.                                         /* Now extract drive and path info terminated
  28.                                            by a backslash */
  29. SourceDirectory=FileSpec('Drive', InstallationFileName)||FileSpec('Path', InstallationFileName)
  30.                                         /* Get \OS2\ directory of boot drive */
  31. OS2Directory=FileSpec('Drive',Value('SYSTEM_INI', , 'OS2ENVIRONMENT'))||'\OS2\'
  32.  
  33. Call AnsiSetup                          /* Setup ANSI colors */
  34. Say LWhi||BBlu'Abcd'                    /* Set highlighted white on blue */
  35. '@Cls'                                  /* Clear screen to set new color */
  36.  
  37.  
  38.                                         /* Ask user what he wants to do, or take
  39.                                            the first commandline arguement when
  40.                                            possible */
  41. InstallationOption=Arg1
  42. If InstallationOption\="I" & InstallationOption\="U" & InstallationOption\="D" & InstallationOption\="P"
  43.     Then Do
  44.     InstallationOption=InstallationMainPanel()
  45.     End
  46. Select
  47.                                         /* If the user wants to quit exit */
  48.     When InstallationOption="Q" Then
  49.         Do
  50.         End
  51.                                         /* If the user wants to install/update PC/2
  52.                                            then get the destination directory, prompt
  53.                                            the user for PC/2, WPS 2 PC/2 or both, update
  54.                                            the files and inform the user */
  55.     When InstallationOption="I" Then
  56.         Do
  57.                                         /* Get the destination directory */
  58.         DestinationDirectory=Arg2
  59.         DestinationDirectory=GetDestinationDirectory(DestinationDirectory)
  60.                                         /* If the user entered QUIT as the destination
  61.                                            directory, because he has to deinstall a
  62.                                            running version of PC/2 first exit */
  63.         If DestinationDirectory="QUIT" Then
  64.             Exit
  65.                                             /* Add terminating backslash */
  66.         DestinationDirectory=DestinationDirectory||"\"
  67.                                         /* Now get the package of PC/2 to install,
  68.                                            either PC/2 (P), WPS 2 PC/2 (W) or both (B) */
  69.         SubPackageSelected=Arg3
  70.         SubPackageSelected=GetSubPackage2Install(SubPackageSelected)
  71.                                         /* Now copy files from current directory to
  72.                                            destination directory */
  73.         CopySuccess=InstallFiles(SubPackageSelected, SourceDirectory, DestinationDirectory, OS2Directory)
  74.                                         /* Ask user for -SingleClickFlag */
  75.         SingleClickFlag=Arg4
  76.         SingleClickFlag=QueryOptions(SingleClickFlag)
  77.                                         /* Now recreate WPS Objects */
  78.         Ignore=CreateWPSObjects(InstallationOption, SubPackageSelected, DestinationDirectory, OS2Directory, SingleClickFlag)
  79.                                         /* Inform user about some usefull things */
  80.         FAQFlag=Arg5
  81.         Ignore=DisplayHint(FAQFlag)
  82.         End
  83.                                         /* If the user wants to recreate the WPS
  84.                                            Objects of the PC/2 package prompt user
  85.                                            for PC/2, WPS 2 PC/2 or both */
  86.     When InstallationOption="U" Then
  87.         Do
  88.                                         /* Now get the package of PC/2 to install,
  89.                                            either PC/2 (P), WPS 2 PC/2 (W) or both (B) */
  90.         SubPackageSelected=Arg3
  91.         SubPackageSelected=GetSubPackage2Install(SubPackageSelected)
  92.                                         /* Ask user for -SingleClickFlag */
  93.         If (SubPackageSelected="P" | SubPackageSelected="B") Then
  94.             Do
  95.             SingleClickFlag=Arg4
  96.             SingleClickFlag=QueryOptions(SingleClickFlag)
  97.             End
  98.         Else
  99.             SingleClickFlag=""
  100.                                         /* Now recreate WPS Objects */
  101.         Ignore=CreateWPSObjects(InstallationOption, SubPackageSelected, SourceDirectory, OS2Directory, SingleClickFlag)
  102.         End
  103.                                         /* If the user wants to delete the WPS program Objects
  104.                                            for PC/2 and WPS 2 PC/2 destroy them */
  105.     When InstallationOption="D" Then
  106.         Do
  107.         Ignore=DeleteWPSObjects("B")
  108.         End
  109.                                         /* If the user wants to delete all files, delete them */
  110.     When InstallationOption="P" Then
  111.         Do
  112.                                         /* Purge all PC/2 files in the current directory and all
  113.                                            WPS 2 PC/2 files in the \OS2\ subdirectory */
  114.         Ignore=PurgeFiles(SourceDirectory, OS2Directory)
  115.         End
  116. End
  117.                                         /* Change to the drive where we installed from */
  118. Command="@"Filespec("Drive", SourceDirectory)" >NUL"
  119. Command
  120.                                         /* Change in the directory */
  121. Command="@CD "Strip(Filespec("Path", SourceDirectory), T, "\")" >NUL"
  122. Command
  123. Say LWhi
  124. Say "   And now - enjoy!- And now - enjoy!- And now - enjoy!- And now - enjoy!"
  125. Say Non||Whi||BBla
  126. Exit
  127.  
  128. /*--------------------------------------------------------------------------------------*\
  129.  * Setup ANSI colors                                                                    *
  130.  * Req:                                                                                 *
  131.  *      none                                                                            *
  132.  * Returns:                                                                             *
  133.  *      none                                                                            *
  134. \*--------------------------------------------------------------------------------------*/
  135. AnsiSetup:
  136.                                         /* ANSI control */
  137. Esc=d2c(27)d2c(91)
  138.                                         /* Attributes */
  139. Bli=esc'5m'
  140. Hig=esc'1m'
  141. Non=esc'0m'
  142.                                         /* Foreground colors */
  143. Bla=esc'30m'
  144. Red=esc'31m'
  145. Gre=esc'32m'
  146. Bro=esc'33m'
  147. Blu=esc'34m'
  148. Cya=esc'35m'
  149. Tur=esc'36m'
  150. Whi=esc'37m'
  151. LBla=Hig||esc'30m'
  152. LRed=Hig||esc'31m'
  153. LGre=Hig||esc'32m'
  154. LBro=Hig||esc'33m'
  155. LBlu=Hig||esc'34m'
  156. LCya=Hig||esc'35m'
  157. LTur=Hig||esc'36m'
  158. LWhi=Hig||esc'37m'
  159.                                         /* Background colors */
  160. BBla=esc'40m'
  161. BRed=esc'41m'
  162. BGre=esc'42m'
  163. BBro=esc'43m'
  164. BBlu=esc'44m'
  165. BCya=esc'45m'
  166. BTur=esc'46m'
  167. BWhi=esc'47m'
  168. Return
  169.  
  170. /*--------------------------------------------------------------------------------------*\
  171.  * Copy files from current directory to destination directory                           *
  172.  * Req:                                                                                 *
  173.  *      FileName ...... File to copy                                                    *
  174.  *      CopyDirectory . Directory to copy to                                            *
  175.  * Returns:                                                                             *
  176.  *      Success ....... TRUE/FALSE                                                      *
  177. \*--------------------------------------------------------------------------------------*/
  178. FileCopy: Arg FileName, CopyDirectory1, CopyDirectory2
  179. Success="TRUE"
  180. Parse Value SysCurPos() with Row Col
  181. If CopyDirectory2="" Then
  182.     Do
  183.     Say " Copying "FileName" to "CopyDirectory1
  184.     Command='@Copy 'FileName' 'CopyDirectory1' /v >NUL 2>NUL'
  185.     Command
  186.     If rc\=0 Then
  187.         Success="FALSE"
  188.     End
  189. Else
  190.     Do
  191.     Say " Copying "FileName" to "CopyDirectory1" , "CopyDirectory2
  192.     Command='@Copy 'FileName' 'CopyDirectory1' /v >NUL 2>NUL'
  193.     Command
  194.     If rc\=0 Then
  195.         Success="FALSE"
  196.     Command='@Copy 'FileName' 'CopyDirectory2' /v >NUL 2>NUL'
  197.     Command
  198.     If rc\=0 Then
  199.         Success="FALSE"
  200.     End
  201. Col=Col+60
  202. Call SysCurPos Row, Col
  203. If Success="TRUE" Then
  204.     Say "Copied"
  205. Else
  206.     Say LBro"Failed"LWhi
  207. Return Success
  208.  
  209. /*--------------------------------------------------------------------------------------*\
  210.  * Delete files at the source directory.                                                *
  211.  * Req:                                                                                 *
  212.  *      FileName ...... File to delete                                                  *
  213.  *      DeleteDirectory Directory to delete from                                        *
  214.  * Returns:                                                                             *
  215.  *      Success ....... TRUE/FALSE                                                      *
  216. \*--------------------------------------------------------------------------------------*/
  217. FileDelete: Arg FileName, DeleteDirectory1, DeleteDirectory2
  218. Success="TRUE"
  219. Parse Value SysCurPos() with Row Col
  220. If DeleteDirectory2="" Then
  221.     Do
  222.     Say " Deleting "FileName" from "DeleteDirectory1
  223.     Command='@Del 'DeleteDirectory1||FileName' >NUL 2>NUL'
  224.     Command
  225.     If rc\=0 Then
  226.         Success="FALSE"
  227.     End
  228. Else
  229.     Do
  230.     Say " Deleting "FileName" from "DeleteDirectory1" , "DeleteDirectory2
  231.     Command='@Del 'DeleteDirectory1||FileName' >NUL 2>NUL'
  232.     Command
  233.     If rc\=0 Then
  234.         Success="FALSE"
  235.     Command='@Del 'DeleteDirectory2||FileName' >NUL 2>NUL'
  236.     Command
  237.     If rc\=0 Then
  238.         Success="FALSE"
  239.     End
  240. Col=Col+60
  241. Call SysCurPos Row, Col
  242. If Success="TRUE" Then
  243.     Say "Deleted"
  244. Else
  245.     Say LBro"Failed"LWhi
  246. Return Success
  247.  
  248. /*--------------------------------------------------------------------------------------*\
  249.  * Display the logo lines                                                               *
  250.  * Req:                                                                                 *
  251.  *      none                                                                            *
  252.  * Returns:                                                                             *
  253.  *      none                                                                            *
  254. \*--------------------------------------------------------------------------------------*/
  255. DisplayLogo:
  256. Say LWhi||BBlu
  257. '@Cls'
  258. Say
  259. Say "                 "LRed"PC/2 - Program Commander/2 Version 1.80 for"LWhi
  260. Say "                       "LRed"IBM OS/2 2.x Presentation Manager"LWhi
  261. Say "                    "LRed"Copyright (C) by Stangl Roman 01, 1995"LWhi
  262. Return
  263.  
  264. /*--------------------------------------------------------------------------------------*\
  265.  * Display the the main panel of PC/2's installation.                                   *
  266.  * Req:                                                                                 *
  267.  *      DisplayLogo                                                                     *
  268.  * Returns:                                                                             *
  269.  *      I/D/P/Q                                                                         *
  270. \*--------------------------------------------------------------------------------------*/
  271. InstallationMainPanel:
  272. Do Until (InstallationOption="I" | InstallationOption="U" | InstallationOption="D" | InstallationOption="P" | InstallationOption="Q")
  273.     Call DisplayLogo
  274.     Say
  275.     Say " "LGre"I"LWhi" ... Select this choice to install a new version, or to update an existing"
  276.     Say "       version of the "LRed"PC/2"LWhi" package (containing the subpackages "LRed"PC/2"LWhi" and "
  277.     Say "       "LRed"WPS 2 PC/2"LWhi") on your system."
  278.     Say
  279.     Say " "LGre"U"LWhi" ... Select this option to recreate accidentially deleted WPS program"
  280.     Say "       Objects for "LRed"PC/2"LWhi" and/or "LRed"WPS 2 PC/2"LWhi" programs on your Desktop."
  281.     Say
  282.     Say " "LGre"D"LWhi" ... Select this choice to delete the WPS Objects created by the "LRed"PC/2"LWhi
  283.     Say "       Installation program. After deleting these Objects some files are locked"
  284.     Say "       until the next reboot. Therefore after the next reboot you may want to"
  285.     Say "       continue with the "LGre"P"LWhi"urge option, to completely remove the files from"
  286.     Say "       your disk."
  287.     Say
  288.     Say " "LGre"P"LWhi" ... Select this choice to delete all files of the "LRed"PC/2"LWhi" package from your"
  289.     Say "       disk."
  290.     Say
  291.     Say " "LGre"Q"LWhi" ... Quit Installation without any changes."
  292.     Say
  293.     Parse Value SysCurPos() with Row Col
  294.     Say " Please enter your selection and press the Enter key:"LGre
  295.                                             /* Prompt the user for a selection and
  296.                                                return it */
  297.     Col=Col+54
  298.     Call SysCurPos Row, Col
  299.     Pull InstallationOption
  300. End
  301. Return InstallationOption
  302.  
  303. /*--------------------------------------------------------------------------------------*\
  304.  * Request the directory to install PC/2 into and create it.                            *
  305.  * Req:                                                                                 *
  306.  *      DisplayLogo                                                                     *
  307.  * Returns:                                                                             *
  308.  *      Directory to copy PC/2's files into                                             *
  309. \*--------------------------------------------------------------------------------------*/
  310. GetDestinationDirectory: Arg DestinationDirectory
  311. If DestinationDirectory\="" Then
  312.     Do
  313.                                             /* Test for installation directory */
  314.     Call SysFileTree DestinationDirectory, FileDirectory, 'D'
  315.     If FileDirectory.0='0' Then
  316.         Do
  317.                                             /* Make the installation directory */
  318.         Rc=SysMkDir(DestinationDirectory)
  319.         If Rc\=0 Then
  320.             DestinationDirectory=""
  321.         End
  322.     End
  323. Do While DestinationDirectory=""
  324.     Call DisplayLogo
  325.     Say
  326.     Say " You selected to install a new version, or update and existing version of "LRed"PC/2"LWhi"."
  327.     Say
  328.     Say " If a version of "LRed"PC/2"LWhi" is currently running, then please close it now."
  329.     Say " If you have already installed "LRed"WPS 2 PC/2"LWhi" please run the deinstallation"
  330.     Say " process of that version. These steps are required, because otherwise files"
  331.     Say " that are going to be updated are locked."
  332.     Say
  333.     Say " If you are ready to continue installation, please enter the destination "
  334.     Say " directory to install "LRed"PC/2"LWhi" into, or enter "LGre"Quit"LWhi" to abort installation."
  335.     Say
  336.     Say " As "LRed"PC/2"LWhi" does not require any changes in Config.sys, a unique directory is"
  337.     Say " suggested."
  338.     Say
  339.     Say " Example for destination directory: "LGre"C:\PMAPPS\PC2"LWhi
  340.     Say
  341.     Parse Value SysCurPos() with Row Col
  342.     Say " Please input destination directory: "LGre
  343.     Col=Col+37
  344.     Call SysCurPos Row, Col
  345.     Pull DestinationDirectory
  346.                                             /* Test for installation directory */
  347.     Call SysFileTree DestinationDirectory, FileDirectory, 'D'
  348.     If FileDirectory.0='0' Then
  349.         Do
  350.                                             /* Make the installation directory */
  351.         Rc=SysMkDir(DestinationDirectory)
  352.         If Rc\=0 Then
  353.             Do
  354.             Say LBro
  355.             Say " "LBro"Sorry, the desired directory couldn't be created, please correct your"
  356.             Parse Value SysCurPos() with Row Col
  357.             Say " input! Press any key to retry."
  358.             Col=Col+32
  359.             Call SysCurPos Row, Col
  360.             Pull Ignore
  361.             DestinationDirectory=""
  362.             End
  363.     End
  364. End
  365. Return DestinationDirectory
  366.  
  367. /*--------------------------------------------------------------------------------------*\
  368.  * Prompt the user for the PC/2 subpackage to install/recreate. This may be PC/2,       *
  369.  * WPS 2 PC/2 or both.                                                                  *
  370.  * Req:                                                                                 *
  371.  *      DisplayLogo                                                                     *
  372.  * Returns:                                                                             *
  373.  *      P/W/B                                                                           *
  374. \*--------------------------------------------------------------------------------------*/
  375. GetSubPackage2Install: Arg SubPackageSelected
  376. Call DisplayLogo
  377. Do While (SubPackageSelected\="P" & SubPackageSelected\="W" & SubPackageSelected\="B")
  378.     Call DisplayLogo
  379.     Say
  380.     Say " "LGre"P"LWhi" ... Install or update "LRed"PC/2"LWhi
  381.     Say
  382.     Say "       Select this choice to install/recreate the "LRed"PC/2"LWhi" WPS program"
  383.     Say "       Object of the "LRed"PC/2"LWhi" package."
  384.     Say
  385.     Say " "LGre"W"LWhi" ... Install or update "LRed"WPS 2 PC/2"LWhi
  386.     Say
  387.     Say "       Select this choice to install/recreate the "LRed"WPS 2 PC2"LWhi" WPS"
  388.     Say "       program Object of the WPS of the "LRed"PC/2"LWhi" package."
  389.     Say
  390.     Say " "LGre"B"LWhi" ... Install or update both programs"
  391.     Say
  392.     Say "       Select this choice to install/recreate both program objects onto the"
  393.     Say "       WPS."
  394.     Say
  395.     Parse Value SysCurPos() with Row Col
  396.     Say " Please enter your selection and press the Enter key:"LGre
  397.                                             /* Prompt the user for a selection and
  398.                                                return it */
  399.     Col=Col+54
  400.     Call SysCurPos Row, Col
  401.     Pull SubPackageSelected
  402. End
  403. Return SubPackageSelected
  404.  
  405. /*--------------------------------------------------------------------------------------*\
  406.  * Copy all required files to the installation destination directory, Take care not to  *
  407.  * overwrite a PC2.cfg configuration file.                                              *
  408.  * Req:                                                                                 *
  409.  *      DisplayLogo                                                                     *
  410.  * Returns:                                                                             *
  411.  *      Success ....... TRUE/FALSE                                                      *
  412. \*--------------------------------------------------------------------------------------*/
  413. InstallFiles: Arg SubPackageSelected, SourceDirectory, DestinationDirectory, OS2Directory
  414. CopySuccess="TRUE"
  415.                                         /* Now copy files */
  416. Call DisplayLogo
  417. Say
  418. Say " Now copying files..."
  419. Say
  420. If (SubPackageSelected="P" | SubPackageSelected="B") Then
  421.     Do
  422.     If FileCopy(PC2.EXE, DestinationDirectory)="FALSE" Then
  423.         CopySuccess="FALSE"
  424.     If FileCopy(PC2HOOK.DLL, DestinationDirectory)="FALSE" Then
  425.         CopySuccess="FALSE"
  426.     If FileCopy(PC2SPOOL.DLL, DestinationDirectory)="FALSE" Then
  427.         CopySuccess="FALSE"
  428.     If FileCopy(PC2.HLP, DestinationDirectory)="FALSE" Then
  429.         CopySuccess="FALSE"
  430.     If FileCopy(PC2.DOC, DestinationDirectory)="FALSE" Then
  431.         CopySuccess="FALSE"
  432.     If FileCopy(PC2.FAQ, DestinationDirectory)="FALSE" Then
  433.         CopySuccess="FALSE"
  434.     If FileCopy(INSTALL.CMD, DestinationDirectory)="FALSE" Then
  435.         CopySuccess="FALSE"
  436.     If FileCopy(SMALLFNT.CMD, DestinationDirectory)="FALSE" Then
  437.         CopySuccess="FALSE"
  438.     If FileCopy(SYSLEVEL.PC2, DestinationDirectory)="FALSE" Then
  439.         CopySuccess="FALSE"
  440.     If FileCopy(DEMOCFG.ZIP, DestinationDirectory)="FALSE" Then
  441.         CopySuccess="FALSE"
  442.     If FileCopy(SOURCE.ZIP, DestinationDirectory)="FALSE" Then
  443.         CopySuccess="FALSE"
  444.                                         /* Test for existing PC2.cfg */
  445.     Call SysFileTree DestinationDirectory||"PC2.cfg", File, 'F'
  446.     If File.0='0' Then
  447.         Do
  448.         If FileCopy(PC2.cfg, DestinationDirectory)="FALSE" Then
  449.             CopySuccess="FALSE"
  450.         End
  451.     Else
  452.         Do
  453.         Parse Value SysCurPos() with Row Col
  454.         Say " Found existing PC2.CFG at "DestinationDirectory
  455.         Col=Col+60
  456.         Call SysCurPos Row, Col
  457.         Say LBro"Skipped"LWhi
  458.         End
  459.                                         /* Test for existing PC2.ini */
  460.     Call SysFileTree DestinationDirectory||"PC2.ini", File, 'F'
  461.     If File.0='0' Then
  462.         Do
  463.         If FileCopy(PC2.ini, DestinationDirectory)="FALSE" Then
  464.             CopySuccess="FALSE"
  465.         End
  466.     Else
  467.         Do
  468.         Parse Value SysCurPos() with Row Col
  469.         Say " Found existing PC2.INI at "DestinationDirectory
  470.         Col=Col+60
  471.         Call SysCurPos Row, Col
  472.         Say LBro"Skipped"LWhi
  473.         End
  474.     End
  475. If (SubPackageSelected="W" | SubPackageSelected="B") Then
  476.     Do
  477.     If FileCopy(WPS2PC2.DLL, DestinationDirectory, OS2Directory||"DLL\")="FALSE" Then
  478.         CopySuccess="FALSE"
  479.     If FileCopy(WPS2PC2.HLP, DestinationDirectory, OS2Directory||"HELP\")="FALSE" Then
  480.         CopySuccess="FALSE"
  481.     End
  482.                                         /* On error wait for user acknowledgement */
  483. If CopySuccess="FALSE" Then
  484.     Do
  485.     Say
  486.     Parse Value SysCurPos() with Row Col
  487.     Say " Press any key to continue..."
  488.     Col=Col+30
  489.     Call SysCurPos Row, Col
  490.     Pull Ignore
  491.     End
  492. Return CopySuccess
  493.  
  494. /*--------------------------------------------------------------------------------------*\
  495.  * Ask the user for the -SingleClick flag instead of the default DoubleClick.           *
  496.  * Req:                                                                                 *
  497.  *      DisplayLogo                                                                     *
  498.  * Returns:                                                                             *
  499.  *      SingleClickFlag Y/N                                                             *
  500. \*--------------------------------------------------------------------------------------*/
  501.                                         /* Now ask the user for -SingleClick flag */
  502. QueryOptions: Arg SingleClickFlag
  503. Do While (SingleClickFlag\="Y" & SingleClickFlag\="N")
  504.     Call DisplayLogo
  505.     Say
  506.                                         /* Ask the user if he wants to display the Popup-
  507.                                            Menu after a single-click instead of a double-
  508.                                            click with mouse button 1 */
  509.     Say " Do you want the "LRed"PC/2"LWhi"'s Popup-Menu displayed after a single-click with mouse"
  510.     Parse Value SysCurPos() with Row Col
  511.     Say " button 1 instead of the default double click? [Y/y/N/n]: "LGre
  512.     Col=Col+58
  513.     Call SysCurPos Row, Col
  514.     Pull SingleClickFlag
  515. End
  516. Return SingleClickFlag
  517.  
  518. /*--------------------------------------------------------------------------------------*\
  519.  * Create the WPS Objects of PC/2 and/or WPS 2 PC/2.                                    *
  520.  * Req:                                                                                 *
  521.  *      DisplayLogo                                                                     *
  522.  * Returns:                                                                             *
  523.  *      Success ....... TRUE/FALSE                                                      *
  524. \*--------------------------------------------------------------------------------------*/
  525. CreateWPSObjects: Arg InstallationOption, SubPackageSelected, RunDirectory, OS2Directory, SingleClickFlag
  526.                                         /* Form PC/2 setup string */
  527. If SingleClickFlag='Y' | SingleClickFlag='y' Then
  528.     Do
  529.                                         /* Add -SingleClick to the parameters field */
  530.     PC2SetupString="EXENAME="RunDirectory"\PC2.EXE;STARTUPDIR="RunDirectory";PARAMETERS=-SingleClick;OBJECTID=<WP_PC2>"
  531.     End
  532. Else
  533.     Do
  534.                                         /* Add -DoubleClick to the parameters field */
  535.     PC2SetupString="EXENAME="RunDirectory"\PC2.EXE;STARTUPDIR="RunDirectory";PARAMETERS=-DoubleClick;OBJECTID=<WP_PC2>"
  536.     End
  537.                                         /* Now create/recreate WPS Objects */
  538. Call DisplayLogo
  539. If InstallationOption\="U" Then
  540.     Do
  541.     Say
  542.     Say " Now starting "LRed"PC/2"LWhi" from "RunDirectory"..."
  543.     Say
  544.                                         /* Change to the drive where we installed from */
  545.     Command="@"Filespec("Drive", RunDirectory)" >NUL"
  546.     Command
  547.                                         /* Change in the directory */
  548.     Command="@CD "||Strip(Filespec("Path", RunDirectory), T, "\")||" >NUL"
  549.     Command
  550.                                         /* Now we start PC/2 with help, but check for
  551.                                            the clicking method */
  552.     If SingleClickFlag='Y' Then
  553.         Do
  554.         Command="@Start PC2.exe -SingleClick -INSTALL >NUL"
  555.         End
  556.     Else
  557.         Do
  558.         Command="@Start PC2.exe -INSTALL >NUL"
  559.         End
  560.     Command
  561.     If rc\=0 Then
  562.         Do
  563.         Say " Sorry, I couldn't start "LRed"PC/2"LWhi" for you..."
  564.         End
  565.     Else
  566.         Do
  567.         Say " After you have finished reading all help panels exit "LRed"PC/2"LWhi" and restart it by"
  568.         Say " clicking on the Desktop with mouse button 1. You will notice that the back-"
  569.         Say " ground behind the icon changed its color and shape if "LRed"PC/2"LWhi" is started."
  570.         End
  571.     Say
  572.     Parse Value SysCurPos() with Row Col
  573.     Say " Press any key to continue..."
  574.     Col=Col+30
  575.     Call SysCurPos Row, Col
  576.     Pull Ignore
  577. End
  578. Say
  579. Say " Now creating WPS Objects for "LRed"PC/2"LWhi" and/or "LRed"WPS 2 PC/2"LWhi"..."
  580. Say
  581. Success="TRUE"
  582.                                         /* Create PC/2 Object */
  583. If (SubPackageSelected="P" | SubPackageSelected="B") Then
  584.     Do
  585.     Parse Value SysCurPos() with Row Col
  586.     Call SysCurPos Row, Col
  587.     Say " Installing WPS Object of "LRed"PC/2"LWhi
  588.     Col=Col+40
  589.     Call SysCurPos Row, Col
  590.                                         /* Now create the PC/2 object on the Desktop */
  591.     Rc=SysCreateObject('WPProgram','PC/2','<WP_DESKTOP>',PC2SetupString)
  592.     if Rc<>1 Then
  593.         Do
  594.         Say "SysCreateObject failed"
  595.         Row=Row+1
  596.         Success="FALSE"
  597.         End
  598.     Else
  599.         Do
  600.         Say "SysCreateObject ok"
  601.         Row=Row+1
  602.         End
  603.     Say
  604.     End
  605.                                         /* Create/recreate WPS 2 PC/2 Object */
  606. If (SubPackageSelected="W" | SubPackageSelected="B") Then
  607.     Do
  608.     If FileCopy(WPS2PC2.DLL, OS2Directory||"DLL\")="FALSE" Then
  609.         CopySuccess="FALSE"
  610.     If FileCopy(WPS2PC2.HLP, OS2Directory||"HELP\")="FALSE" Then
  611.         CopySuccess="FALSE"
  612.                                         /* We have to rename WPS 2 PC/2's DLL otherwise
  613.                                            it will be locked (by WPS or WPS2PC2.dll itself ?) */
  614.     Command="@Ren WPS2PC2.dll WPS2PC2.dl_"
  615.     Command
  616.     Command="@Ren WPS2PC2.hlp WPS2PC2.hl_"
  617.     Command
  618.     Say
  619.     Parse Value SysCurPos() with Row Col
  620.     Say " Installing WPS Object of "LRed"WPS 2 PC/2"LWhi
  621.     Call SysCurPos Row, Col
  622.     Col=Col+40
  623.     Call SysCurPos Row, Col
  624.     Rc=SysRegisterObjectClass('Wps2Pc2', OS2Directory||'\DLL\WPS2PC2.DLL');
  625.     If Rc<>1 Then
  626.         Do
  627.         Say "SysRegisterObjectClass failed"
  628.         Row=Row+1
  629.         Success="FALSE"
  630.         End
  631.     Else
  632.         Do
  633.         Say "SysRegisterObjectClass ok"
  634.         Row=Row+1
  635.         End
  636.     Call SysCurPos Row, Col
  637.     SetupString='OBJECTID=<WP_WPS2PC2>;'
  638.     Rc=SysCreateObject('Wps2Pc2', 'WPS 2 PC/2', '<WP_DESKTOP>', SetupString, 'ReplaceIfExists')
  639.     if Rc<>1 Then
  640.         Do
  641.         Say "SysCreateObject failed"
  642.         Row=Row+1
  643.         Success="FALSE"
  644.         End
  645.     Else
  646.         Do
  647.         Say "SysCreateObject ok"
  648.         Row=Row+1
  649.         End
  650.                                         /* Rename WPS 2 PC/2's DLL to original name */
  651.     Command="@Ren WPS2PC2.dl_ WPS2PC2.dll"
  652.     Command
  653.     Command="@Ren WPS2PC2.hl_ WPS2PC2.hlp"
  654.     Command
  655.     End
  656.                                         /* On error wait for user acknowledgement */
  657. If Success="FALSE" Then
  658.     Do
  659.     Say
  660.     Parse Value SysCurPos() with Row Col
  661.     Say " Press any key to continue..."
  662.     Col=Col+30
  663.     Call SysCurPos Row, Col
  664.     Pull Ignore
  665.     End
  666. Return Success
  667.  
  668. /*--------------------------------------------------------------------------------------*\
  669.  * Deletes the WPS Objects of PC/2 and/or WPS 2 PC/2.                                   *
  670.  * Req:                                                                                 *
  671.  *      DisplayLogo                                                                     *
  672.  * Returns:                                                                             *
  673.  *      Success ....... TRUE/FALSE                                                      *
  674. \*--------------------------------------------------------------------------------------*/
  675. DeleteWPSObjects: Arg SubPackageSelected
  676.                                         /* Now delete WPS Objects */
  677. Call DisplayLogo
  678. Say
  679. Say " Now deregistering WPS Objects..."
  680. Say
  681. Success="TRUE"
  682.                                         /* Delete PC/2 Object */
  683. If (SubPackageSelected="P" | SubPackageSelected="B") Then
  684.     Do
  685.     Parse Value SysCurPos() with Row Col
  686.     Call SysCurPos Row, Col
  687.     Say " Deinstalling WPS Object of "LRed"PC/2"LWhi
  688.     Col=Col+40
  689.     Call SysCurPos Row, Col
  690.     Rc=SysDestroyObject('<WP_PC2>');
  691.     if Rc<>1 Then
  692.         Do
  693.         Say "SysDestroyObject failed"
  694.         Row=Row+1
  695.         Success="FALSE"
  696.         End
  697.     Else
  698.         Do
  699.         Say "SysDestroyObject ok"
  700.         Row=Row+1
  701.         End
  702.     Say
  703.     End
  704.                                         /* Delete WPS 2 PC/2 Object */
  705. If (SubPackageSelected="W" | SubPackageSelected="B") Then
  706.     Do
  707.     Parse Value SysCurPos() with Row Col
  708.     Call SysCurPos Row, Col
  709.     Say " Deinstalling WPS Object of "LRed"WPS 2 PC/2"LWhi
  710.     Col=Col+40
  711.     Call SysCurPos Row, Col
  712.     Rc=SysDestroyObject('<WP_WPS2PC2>');
  713.     if Rc<>1 Then
  714.         Do
  715.         Say "SysDestroyObject failed"
  716.         Row=Row+1
  717.         Success="FALSE"
  718.         End
  719.     Else
  720.         Do
  721.         Say "SysDestroyObject ok"
  722.         Row=Row+1
  723.         End
  724.     Call SysCurPos Row, Col
  725.     Rc=SysDeregisterObjectClass('Wps2Pc2');
  726.     If Rc<>1 Then
  727.         Do
  728.         Say "SysDeregisterObjectClass failed"
  729.         Row=Row+1
  730.         Success="FALSE"
  731.         End
  732.     Else
  733.         Do
  734.         Say "SysDeregisterObjectClass ok"
  735.         Row=Row+1
  736.         End
  737.     End
  738.                                         /* On error wait for user acknowledgement */
  739. If Success="FALSE" Then
  740.     Do
  741.     Say
  742.     Say " Because automatic deletion faild, please try to delete the WPS Objects for"
  743.     Say " "LRed"PC/2"LWhi" and "LRed"WPS 2 PC/2"LWhi" manually, by either selecting the Delete option from the"
  744.     Say " WPS Object's context menu, or by dragging them into the Shredder."
  745.     Say
  746.     Parse Value SysCurPos() with Row Col
  747.     Say " Press any key to continue..."
  748.     Col=Col+30
  749.     Call SysCurPos Row, Col
  750.     Pull Ignore
  751.     End
  752. Return Success
  753.  
  754. /*--------------------------------------------------------------------------------------*\
  755.  * Deletes all files of PC/2 in the current directory and all WPS 2 PC/2 files in the   *
  756.  * \OS2\ directory on the boot drive.                                                   *
  757.  * Req:                                                                                 *
  758.  *      DisplayLogo                                                                     *
  759.  * Returns:                                                                             *
  760.  *      Success ....... TRUE/FALSE                                                      *
  761. \*--------------------------------------------------------------------------------------*/
  762. PurgeFiles: Arg SourceDirectory, OS2Directory
  763.                                         /* Now purge files */
  764. Call DisplayLogo
  765. Say
  766. Say " Now deleting files..."
  767. Say
  768. DeleteSuccess="TRUE"
  769. If FileDelete(PC2.EXE, SourceDirectory)="FALSE" Then
  770.     DeleteSuccess="FALSE"
  771. If FileDelete(PC2HOOK.DLL, SourceDirectory)="FALSE" Then
  772.     DeleteSuccess="FALSE"
  773. If FileDelete(PC2SPOOL.DLL, SourceDirectory)="FALSE" Then
  774.     DeleteSuccess="FALSE"
  775. If FileDelete(PC2.HLP, SourceDirectory)="FALSE" Then
  776.     DeleteSuccess="FALSE"
  777. If FileDelete(PC2.DOC, SourceDirectory)="FALSE" Then
  778.     DeleteSuccess="FALSE"
  779. If FileDelete(PC2.FAQ, SourceDirectory)="FALSE" Then
  780.     DeleteSuccess="FALSE"
  781. If FileDelete(INSTALL.CMD, SourceDirectory)="FALSE" Then
  782.     DeleteSuccess="FALSE"
  783. If FileDelete(SMALLFNT.CMD, SourceDirectory)="FALSE" Then
  784.     DeleteSuccess="FALSE"
  785. If FileDelete(SYSLEVEL.PC2, SourceDirectory)="FALSE" Then
  786.     DeleteSuccess="FALSE"
  787. If FileDelete(DEMOCFG.ZIP, SourceDirectory)="FALSE" Then
  788.     DeleteSuccess="FALSE"
  789. If FileDelete(SOURCE.ZIP, SourceDirectory)="FALSE" Then
  790.     DeleteSuccess="FALSE"
  791. If FileDelete(PC2.CFG, SourceDirectory)="FALSE" Then
  792.     DeleteSuccess="FALSE"
  793. If FileDelete(PC2.INI, SourceDirectory)="FALSE" Then
  794.     DeleteSuccess="FALSE"
  795. If FileDelete(WPS2PC2.DLL, SourceDirectory, OS2Directory||"DLL\")="FALSE" Then
  796.     DeleteSuccess="FALSE"
  797. If FileDelete(WPS2PC2.HLP, SourceDirectory, OS2Directory||"HELP\")="FALSE" Then
  798.     DeleteSuccess="FALSE"
  799. If DeleteSuccess="FALSE" Then
  800.     Do
  801.     Say
  802.     Parse Value SysCurPos() with Row Col
  803.     Say " Press any key to continue..."
  804.     Col=Col+30
  805.     Call SysCurPos Row, Col
  806.     Pull Ignore
  807.     End
  808. Return DeleteSuccess
  809.  
  810. /*--------------------------------------------------------------------------------------*\
  811.  * Display hints for user of PC/2 (about SmallFnt.cmd, STARTUPFOLDERSONLY and           *
  812.  * RUNWORKPLACE statements, and the FAQ file).                                          *
  813.  * Req:                                                                                 *
  814.  *      DisplayLogo                                                                     *
  815.  * Returns:                                                                             *
  816.  *      Success ....... TRUE/FALSE                                                      *
  817. \*--------------------------------------------------------------------------------------*/
  818. DisplayHint: Arg FAQFlag
  819.                                         /* Now inform user about SMALLFNT.CMD */
  820. Call DisplayLogo
  821. Say
  822. Say
  823. Say " "LRed"PC/2"LWhi" also ships a small batch file called "LBro"SmallFnt.cmd"LWhi" which you may use to "
  824. Say " replace the default Proportional System font with a smaller 8 pts. Helv font. "
  825. Say " This batch files modifies your "LBro"OS2.INI"Lwhi" file so that after the next reboot "
  826. Say " most dialogs will be much smaller and more information fits on your screen. "
  827. Say " You may also use the Font Palette to drop the 8 pts. Helv font over the "
  828. Say " titlebar and menu of any application while you hold the ALT-key to make this "
  829. Say " font the default on titlebars and menues.. "
  830. Say
  831. Parse Value SysCurPos() with Row Col
  832. Say " Press any key to continue..."
  833. Col=Col+30
  834. Call SysCurPos Row, Col
  835. Pull Ignore
  836.                                         /* Now inform user about STARTUPFOLDERSONLY */
  837. Call DisplayLogo
  838. Say
  839.                                         /* Search for CONFIG.SYS and the statement
  840.                                            SET RESTARTOBJECTS=STARTUPFOLDERSONLY. Thanks
  841.                                            to Stefan Hora for giving me a drive independent
  842.                                            way to get data from actual CONFIG.SYS */
  843. FoundConfig=FALSE
  844. WorkPlace=strip(Value("RESTARTOBJECTS", , "OS2ENVIRONMENT"))
  845. if POS('STARTUPFOLDERSONLY', WorkPlace)\=0 Then Do
  846.     FoundConfig=TRUE
  847. End
  848.                                         /* Inform the user about CONFIG.SYS */
  849. If FoundConfig=TRUE Then Do
  850.     Say " You have the statement "LBro"SET RESTARTOBJECTS=STARTUPFOLDERSONLY"LWhi" in your"
  851.     Say " "LBro"CONFIG.SYS"LWhi". To enable OS/2 to start "LRed"PC/2"LWhi" during boot, you have to create"
  852.     Say " a shadow of "LRed"PC/2"LWhi" and move it into your startup folder."
  853. End
  854. Else Do
  855.     Say " You don't have the statement "LBro"SET RESTARTOBJECTS=STARTUPFOLDERSONLY"LWhi" in ypur"
  856.     Say " "LBro"CONFIG.SYS"LWhi". OS/2 will start automatically "LRed"PC/2"LWhi" during next boot, if "LRed"PC/2"LWhi" is"
  857.     Say " active before you Shutdown your System."
  858. End
  859. Say
  860. Parse Value SysCurPos() with Row Col
  861. Say " Press any key to continue..."
  862. Col=Col+30
  863. Call SysCurPos Row, Col
  864. Pull Ignore
  865.                                         /* Now inform user about RUNWORKPLACE */
  866. Call DisplayLogo
  867. Say
  868.                                         /* Now search for CONFIG.SYS and the statement
  869.                                            SET RUNWORKPLACE=C:\OS2\PMSHELL.EXE. Again thanks
  870.                                            to Stefan Hora for his drive independent approach */
  871. FoundConfig=FALSE
  872. WorkPlace=strip(Value("RUNWORKPLACE", , "OS2ENVIRONMENT"))
  873. if POS('PMSHELL.EXE', WorkPlace)\=0 Then Do
  874.     FoundConfig=TRUE
  875. End
  876.                                         /* Inform the user about CONFIG.SYS */
  877. If FoundConfig=TRUE Then Do
  878.     Say " You have the statement "LBro"SET RUNWORKPLACE=C:\OS2\PMSHELL.EXE"LWhi" in your"
  879.     Say " "LBro"CONFIG.SYS"LWhi". You may replace the "LBro"WPS"LWhi" by "LRed"PC/2"LWhi", please look into the online"
  880.     Say " help panels of "LRed"PC/2"LWhi" for further information."
  881. End
  882. Else Do
  883.     Say " It seems that you don't run the "LBro"WPS"LWhi" ("LBro"WorkPlace Shell"LWhi"). You may use "LRed"PC/2"LWhi" as"
  884.     Say " a replacement for the WPS by adding to or modifying your "LBro"CONFIG.SYS"LWhi":"
  885.     Say " "LGre"SET RUNWORKPLACE="DestinationDirectory"\PC2.EXE"LWhi
  886.     Say " But be sure that "LRed"PC2HOOK.DLL"LWhi", "LRed"PC2SPOOL.DLL"LWhi" and "LRed"PC2.HLP"LWhi" are in the directory"
  887.     Say " you started "LRed"PC/2"LWhi" from."
  888.     Say " Please look into the online help panels of "LRed"PC/2"LWhi" for further information."
  889. End
  890. Say
  891. Parse Value SysCurPos() with Row Col
  892. Say " Press any key to continue..."
  893. Col=Col+30
  894. Call SysCurPos Row, Col
  895. Pull Ignore
  896.                                         /* Now inform user about FAQ */
  897. If FAQFlag="" Then
  898.     Do
  899.     Call DisplayLogo
  900.     Say
  901.                                         /* Inform the user about safety */
  902.     Say " Don't forget to backup your configuration file regularily to avoid possible"
  903.     Say " damages to your configuration file."
  904.     Say " If you drag a shadow of "LRed"PC/2"LWhi" into the startup folder and have not set"
  905.     Say " "LBro"SET RESTARTOBJECTS=STARTUPFOLDERSONLY"LWhi" in your "LBro"CONFIG.SYS"LWhi" ensure that during"
  906.     Say " loading of the "LBro"WPS"LWhi" "LRed"PC/2"LWhi" is only started by the startup folder to avoid an"
  907.     Say " informational message."
  908.     Say
  909.     Say " If you find this utility useful and want to honor many weeks of work, you are"
  910.     Say " welcome to send me a small donation. Please read the online documentation for"
  911.     Say " further information - Thank you!"
  912.     Say
  913.     Parse Value SysCurPos() with Row Col
  914.     Say " Do you want to read the FAQ (Frequently Asked Questions) list? [Y/y/N/n]: "LGre
  915.                                         /* Ask the user if he wants to read the FAQ */
  916.     Col=Col+75
  917.     Call SysCurPos Row, Col
  918.     Pull FAQFlag
  919.     End
  920. If FAQFlag='Y' Then Do
  921.     Call DisplayLogo
  922.     Command="@Type PC2.faq |more"
  923.     Command
  924.     Say
  925.     Say LWhi"   And now - enjoy! - And now - enjoy! - And now - enjoy! - And Now - enjoy!"
  926.     End
  927. Return "TRUE"
  928.  
  929. /*--------------------------------------------------------------------------------------*\
  930.  * The CTRL+Break signal handler just ignores CTRL+BREAK.                               *
  931.  * Req:                                                                                 *
  932.  *      none                                                                            *
  933.  * Returns:                                                                             *
  934.  *      none                                                                            *
  935. \*--------------------------------------------------------------------------------------*/
  936. SignalHandler:
  937. Return "TRUE"
  938.  
  939.