home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1995 November / PCWK1195.iso / inne / podstawy / os2 / nakladki / pc2v190.exe / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1995-05-01  |  43KB  |  943 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.90 05,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.90 for"LWhi
  260. Say "                    "LRed"IBM OS/2 2.x, 3.x Presentation Manager"LWhi
  261. Say "                    "LRed"Copyright (C) by Stangl Roman 05, 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(PC2SLOW.EXE, DestinationDirectory)="FALSE" Then
  425.         CopySuccess="FALSE"
  426.     If FileCopy(PC2HOOK.DLL, DestinationDirectory)="FALSE" Then
  427.         CopySuccess="FALSE"
  428.     If FileCopy(PC2SPOOL.DLL, DestinationDirectory)="FALSE" Then
  429.         CopySuccess="FALSE"
  430.     If FileCopy(PC2.HLP, DestinationDirectory)="FALSE" Then
  431.         CopySuccess="FALSE"
  432.     If FileCopy(PC2.DOC, DestinationDirectory)="FALSE" Then
  433.         CopySuccess="FALSE"
  434.     If FileCopy(PC2.FAQ, DestinationDirectory)="FALSE" Then
  435.         CopySuccess="FALSE"
  436.     If FileCopy(INSTALL.CMD, DestinationDirectory)="FALSE" Then
  437.         CopySuccess="FALSE"
  438.     If FileCopy(SMALLFNT.CMD, DestinationDirectory)="FALSE" Then
  439.         CopySuccess="FALSE"
  440.     If FileCopy(SYSLEVEL.PC2, DestinationDirectory)="FALSE" Then
  441.         CopySuccess="FALSE"
  442.     If FileCopy(DEMOCFG.ZIP, DestinationDirectory)="FALSE" Then
  443.         CopySuccess="FALSE"
  444.     If FileCopy(SOURCE.ZIP, DestinationDirectory)="FALSE" Then
  445.         CopySuccess="FALSE"
  446.                                         /* Test for existing PC2.cfg */
  447.     Call SysFileTree DestinationDirectory||"PC2.cfg", File, 'F'
  448.     If File.0='0' Then
  449.         Do
  450.         If FileCopy(PC2.cfg, DestinationDirectory)="FALSE" Then
  451.             CopySuccess="FALSE"
  452.         End
  453.     Else
  454.         Do
  455.         Parse Value SysCurPos() with Row Col
  456.         Say " Found existing PC2.CFG at "DestinationDirectory
  457.         Col=Col+60
  458.         Call SysCurPos Row, Col
  459.         Say LBro"Skipped"LWhi
  460.         End
  461.                                         /* Test for existing PC2.ini */
  462.     Call SysFileTree DestinationDirectory||"PC2.ini", File, 'F'
  463.     If File.0='0' Then
  464.         Do
  465.         If FileCopy(PC2.ini, DestinationDirectory)="FALSE" Then
  466.             CopySuccess="FALSE"
  467.         End
  468.     Else
  469.         Do
  470.         Parse Value SysCurPos() with Row Col
  471.         Say " Found existing PC2.INI at "DestinationDirectory
  472.         Col=Col+60
  473.         Call SysCurPos Row, Col
  474.         Say LBro"Skipped"LWhi
  475.         End
  476.     End
  477. If (SubPackageSelected="W" | SubPackageSelected="B") Then
  478.     Do
  479.     If FileCopy(WPS2PC2.DLL, DestinationDirectory, OS2Directory||"DLL\")="FALSE" Then
  480.         CopySuccess="FALSE"
  481.     If FileCopy(WPS2PC2.HLP, DestinationDirectory, OS2Directory||"HELP\")="FALSE" Then
  482.         CopySuccess="FALSE"
  483.     End
  484.                                         /* On error wait for user acknowledgement */
  485. If CopySuccess="FALSE" Then
  486.     Do
  487.     Say
  488.     Parse Value SysCurPos() with Row Col
  489.     Say " Press any key to continue..."
  490.     Col=Col+30
  491.     Call SysCurPos Row, Col
  492.     Pull Ignore
  493.     End
  494. Return CopySuccess
  495.  
  496. /*--------------------------------------------------------------------------------------*\
  497.  * Ask the user for the -SingleClick flag instead of the default DoubleClick.           *
  498.  * Req:                                                                                 *
  499.  *      DisplayLogo                                                                     *
  500.  * Returns:                                                                             *
  501.  *      SingleClickFlag Y/N                                                             *
  502. \*--------------------------------------------------------------------------------------*/
  503.                                         /* Now ask the user for -SingleClick flag */
  504. QueryOptions: Arg SingleClickFlag
  505. Do While (SingleClickFlag\="Y" & SingleClickFlag\="N")
  506.     Call DisplayLogo
  507.     Say
  508.                                         /* Ask the user if he wants to display the Popup-
  509.                                            Menu after a single-click instead of a double-
  510.                                            click with mouse button 1 */
  511.     Say " Do you want the "LRed"PC/2"LWhi"'s Popup-Menu displayed after a single-click with mouse"
  512.     Parse Value SysCurPos() with Row Col
  513.     Say " button 1 instead of the default double click? [Y/y/N/n]: "LGre
  514.     Col=Col+58
  515.     Call SysCurPos Row, Col
  516.     Pull SingleClickFlag
  517. End
  518. Return SingleClickFlag
  519.  
  520. /*--------------------------------------------------------------------------------------*\
  521.  * Create the WPS Objects of PC/2 and/or WPS 2 PC/2.                                    *
  522.  * Req:                                                                                 *
  523.  *      DisplayLogo                                                                     *
  524.  * Returns:                                                                             *
  525.  *      Success ....... TRUE/FALSE                                                      *
  526. \*--------------------------------------------------------------------------------------*/
  527. CreateWPSObjects: Arg InstallationOption, SubPackageSelected, RunDirectory, OS2Directory, SingleClickFlag
  528.                                         /* Form PC/2 setup string */
  529. If SingleClickFlag='Y' | SingleClickFlag='y' Then
  530.     Do
  531.                                         /* Add -SingleClick to the parameters field */
  532.     PC2SetupString="EXENAME="RunDirectory"\PC2.EXE;STARTUPDIR="RunDirectory";PARAMETERS=-SingleClick;OBJECTID=<WP_PC2>"
  533.     End
  534. Else
  535.     Do
  536.                                         /* Add -DoubleClick to the parameters field */
  537.     PC2SetupString="EXENAME="RunDirectory"\PC2.EXE;STARTUPDIR="RunDirectory";PARAMETERS=-DoubleClick;OBJECTID=<WP_PC2>"
  538.     End
  539.                                         /* Now create/recreate WPS Objects */
  540. Call DisplayLogo
  541. If InstallationOption\="U" Then
  542.     Do
  543.     Say
  544.     Say " Now starting "LRed"PC/2"LWhi" from "RunDirectory"..."
  545.     Say
  546.                                         /* Change to the drive where we installed from */
  547.     Command="@"Filespec("Drive", RunDirectory)" >NUL"
  548.     Command
  549.                                         /* Change in the directory */
  550.     Command="@CD "||Strip(Filespec("Path", RunDirectory), T, "\")||" >NUL"
  551.     Command
  552.                                         /* Now we start PC/2 with help, but check for
  553.                                            the clicking method */
  554.     If SingleClickFlag='Y' Then
  555.         Do
  556.         Command="@Start PC2.exe -SingleClick -INSTALL >NUL"
  557.         End
  558.     Else
  559.         Do
  560.         Command="@Start PC2.exe -INSTALL >NUL"
  561.         End
  562.     Command
  563.     If rc\=0 Then
  564.         Do
  565.         Say " Sorry, I couldn't start "LRed"PC/2"LWhi" for you..."
  566.         End
  567.     Else
  568.         Do
  569.         Say " After you have finished reading all help panels exit "LRed"PC/2"LWhi" and restart it by"
  570.         Say " clicking on the Desktop with mouse button 1. You will notice that the back-"
  571.         Say " ground behind the icon changed its color and shape if "LRed"PC/2"LWhi" is started."
  572.         End
  573.     Say
  574.     Parse Value SysCurPos() with Row Col
  575.     Say " Press any key to continue..."
  576.     Col=Col+30
  577.     Call SysCurPos Row, Col
  578.     Pull Ignore
  579. End
  580. Say
  581. Say " Now creating WPS Objects for "LRed"PC/2"LWhi" and/or "LRed"WPS 2 PC/2"LWhi"..."
  582. Say
  583. Success="TRUE"
  584.                                         /* Create PC/2 Object */
  585. If (SubPackageSelected="P" | SubPackageSelected="B") Then
  586.     Do
  587.     Parse Value SysCurPos() with Row Col
  588.     Call SysCurPos Row, Col
  589.     Say " Installing WPS Object of "LRed"PC/2"LWhi
  590.     Col=Col+40
  591.     Call SysCurPos Row, Col
  592.                                         /* Now create the PC/2 object on the Desktop */
  593.     Rc=SysCreateObject('WPProgram','PC/2','<WP_DESKTOP>',PC2SetupString)
  594.     if Rc<>1 Then
  595.         Do
  596.         Say "SysCreateObject failed"
  597.         Row=Row+1
  598.         Success="FALSE"
  599.         End
  600.     Else
  601.         Do
  602.         Say "SysCreateObject ok"
  603.         Row=Row+1
  604.         End
  605.     Say
  606.     End
  607.                                         /* Create/recreate WPS 2 PC/2 Object */
  608. If (SubPackageSelected="W" | SubPackageSelected="B") Then
  609.     Do
  610.     If FileCopy(WPS2PC2.DLL, OS2Directory||"DLL\")="FALSE" Then
  611.         CopySuccess="FALSE"
  612.     If FileCopy(WPS2PC2.HLP, OS2Directory||"HELP\")="FALSE" Then
  613.         CopySuccess="FALSE"
  614.                                         /* We have to rename WPS 2 PC/2's DLL otherwise
  615.                                            it will be locked (by WPS or WPS2PC2.dll itself ?) */
  616.     Command="@Ren WPS2PC2.dll WPS2PC2.dl_"
  617.     Command
  618.     Command="@Ren WPS2PC2.hlp WPS2PC2.hl_"
  619.     Command
  620.     Say
  621.     Parse Value SysCurPos() with Row Col
  622.     Say " Installing WPS Object of "LRed"WPS 2 PC/2"LWhi
  623.     Call SysCurPos Row, Col
  624.     Col=Col+40
  625.     Call SysCurPos Row, Col
  626.     Rc=SysRegisterObjectClass('Wps2Pc2', OS2Directory||'\DLL\WPS2PC2.DLL');
  627.     If Rc<>1 Then
  628.         Do
  629.         Say "SysRegisterObjectClass failed"
  630.         Row=Row+1
  631.         Success="FALSE"
  632.         End
  633.     Else
  634.         Do
  635.         Say "SysRegisterObjectClass ok"
  636.         Row=Row+1
  637.         End
  638.     Call SysCurPos Row, Col
  639.     SetupString='OBJECTID=<WP_WPS2PC2>;'
  640.     Rc=SysCreateObject('Wps2Pc2', 'WPS 2 PC/2', '<WP_DESKTOP>', SetupString, 'ReplaceIfExists')
  641.     if Rc<>1 Then
  642.         Do
  643.         Say "SysCreateObject failed"
  644.         Row=Row+1
  645.         Success="FALSE"
  646.         End
  647.     Else
  648.         Do
  649.         Say "SysCreateObject ok"
  650.         Row=Row+1
  651.         End
  652.                                         /* Rename WPS 2 PC/2's DLL to original name */
  653.     Command="@Ren WPS2PC2.dl_ WPS2PC2.dll"
  654.     Command
  655.     Command="@Ren WPS2PC2.hl_ WPS2PC2.hlp"
  656.     Command
  657.     End
  658.                                         /* On error wait for user acknowledgement */
  659. If Success="FALSE" Then
  660.     Do
  661.     Say
  662.     Parse Value SysCurPos() with Row Col
  663.     Say " Press any key to continue..."
  664.     Col=Col+30
  665.     Call SysCurPos Row, Col
  666.     Pull Ignore
  667.     End
  668. Return Success
  669.  
  670. /*--------------------------------------------------------------------------------------*\
  671.  * Deletes the WPS Objects of PC/2 and/or WPS 2 PC/2.                                   *
  672.  * Req:                                                                                 *
  673.  *      DisplayLogo                                                                     *
  674.  * Returns:                                                                             *
  675.  *      Success ....... TRUE/FALSE                                                      *
  676. \*--------------------------------------------------------------------------------------*/
  677. DeleteWPSObjects: Arg SubPackageSelected
  678.                                         /* Now delete WPS Objects */
  679. Call DisplayLogo
  680. Say
  681. Say " Now deregistering WPS Objects..."
  682. Say
  683. Success="TRUE"
  684.                                         /* Delete PC/2 Object */
  685. If (SubPackageSelected="P" | SubPackageSelected="B") Then
  686.     Do
  687.     Parse Value SysCurPos() with Row Col
  688.     Call SysCurPos Row, Col
  689.     Say " Deinstalling WPS Object of "LRed"PC/2"LWhi
  690.     Col=Col+40
  691.     Call SysCurPos Row, Col
  692.     Rc=SysDestroyObject('<WP_PC2>');
  693.     if Rc<>1 Then
  694.         Do
  695.         Say "SysDestroyObject failed"
  696.         Row=Row+1
  697.         Success="FALSE"
  698.         End
  699.     Else
  700.         Do
  701.         Say "SysDestroyObject ok"
  702.         Row=Row+1
  703.         End
  704.     Say
  705.     End
  706.                                         /* Delete WPS 2 PC/2 Object */
  707. If (SubPackageSelected="W" | SubPackageSelected="B") Then
  708.     Do
  709.     Parse Value SysCurPos() with Row Col
  710.     Call SysCurPos Row, Col
  711.     Say " Deinstalling WPS Object of "LRed"WPS 2 PC/2"LWhi
  712.     Col=Col+40
  713.     Call SysCurPos Row, Col
  714.     Rc=SysDestroyObject('<WP_WPS2PC2>');
  715.     if Rc<>1 Then
  716.         Do
  717.         Say "SysDestroyObject failed"
  718.         Row=Row+1
  719.         Success="FALSE"
  720.         End
  721.     Else
  722.         Do
  723.         Say "SysDestroyObject ok"
  724.         Row=Row+1
  725.         End
  726.     Call SysCurPos Row, Col
  727.     Rc=SysDeregisterObjectClass('Wps2Pc2');
  728.     If Rc<>1 Then
  729.         Do
  730.         Say "SysDeregisterObjectClass failed"
  731.         Row=Row+1
  732.         Success="FALSE"
  733.         End
  734.     Else
  735.         Do
  736.         Say "SysDeregisterObjectClass ok"
  737.         Row=Row+1
  738.         End
  739.     End
  740.                                         /* On error wait for user acknowledgement */
  741. If Success="FALSE" Then
  742.     Do
  743.     Say
  744.     Say " Because automatic deletion faild, please try to delete the WPS Objects for"
  745.     Say " "LRed"PC/2"LWhi" and "LRed"WPS 2 PC/2"LWhi" manually, by either selecting the Delete option from the"
  746.     Say " WPS Object's context menu, or by dragging them into the Shredder."
  747.     Say
  748.     Parse Value SysCurPos() with Row Col
  749.     Say " Press any key to continue..."
  750.     Col=Col+30
  751.     Call SysCurPos Row, Col
  752.     Pull Ignore
  753.     End
  754. Return Success
  755.  
  756. /*--------------------------------------------------------------------------------------*\
  757.  * Deletes all files of PC/2 in the current directory and all WPS 2 PC/2 files in the   *
  758.  * \OS2\ directory on the boot drive.                                                   *
  759.  * Req:                                                                                 *
  760.  *      DisplayLogo                                                                     *
  761.  * Returns:                                                                             *
  762.  *      Success ....... TRUE/FALSE                                                      *
  763. \*--------------------------------------------------------------------------------------*/
  764. PurgeFiles: Arg SourceDirectory, OS2Directory
  765.                                         /* Now purge files */
  766. Call DisplayLogo
  767. Say
  768. Say " Now deleting files..."
  769. Say
  770. DeleteSuccess="TRUE"
  771. If FileDelete(PC2.EXE, SourceDirectory)="FALSE" Then
  772.     DeleteSuccess="FALSE"
  773. If FileDelete(PC2SLOW.EXE, SourceDirectory)="FALSE" Then
  774.     DeleteSuccess="FALSE"
  775. If FileDelete(PC2HOOK.DLL, SourceDirectory)="FALSE" Then
  776.     DeleteSuccess="FALSE"
  777. If FileDelete(PC2SPOOL.DLL, SourceDirectory)="FALSE" Then
  778.     DeleteSuccess="FALSE"
  779. If FileDelete(PC2.HLP, SourceDirectory)="FALSE" Then
  780.     DeleteSuccess="FALSE"
  781. If FileDelete(PC2.DOC, SourceDirectory)="FALSE" Then
  782.     DeleteSuccess="FALSE"
  783. If FileDelete(PC2.FAQ, SourceDirectory)="FALSE" Then
  784.     DeleteSuccess="FALSE"
  785. If FileDelete(INSTALL.CMD, SourceDirectory)="FALSE" Then
  786.     DeleteSuccess="FALSE"
  787. If FileDelete(SMALLFNT.CMD, SourceDirectory)="FALSE" Then
  788.     DeleteSuccess="FALSE"
  789. If FileDelete(SYSLEVEL.PC2, SourceDirectory)="FALSE" Then
  790.     DeleteSuccess="FALSE"
  791. If FileDelete(DEMOCFG.ZIP, SourceDirectory)="FALSE" Then
  792.     DeleteSuccess="FALSE"
  793. If FileDelete(SOURCE.ZIP, SourceDirectory)="FALSE" Then
  794.     DeleteSuccess="FALSE"
  795. If FileDelete(PC2.CFG, SourceDirectory)="FALSE" Then
  796.     DeleteSuccess="FALSE"
  797. If FileDelete(PC2.INI, SourceDirectory)="FALSE" Then
  798.     DeleteSuccess="FALSE"
  799. If FileDelete(WPS2PC2.DLL, SourceDirectory, OS2Directory||"DLL\")="FALSE" Then
  800.     DeleteSuccess="FALSE"
  801. If FileDelete(WPS2PC2.HLP, SourceDirectory, OS2Directory||"HELP\")="FALSE" Then
  802.     DeleteSuccess="FALSE"
  803. If DeleteSuccess="FALSE" Then
  804.     Do
  805.     Say
  806.     Parse Value SysCurPos() with Row Col
  807.     Say " Press any key to continue..."
  808.     Col=Col+30
  809.     Call SysCurPos Row, Col
  810.     Pull Ignore
  811.     End
  812. Return DeleteSuccess
  813.  
  814. /*--------------------------------------------------------------------------------------*\
  815.  * Display hints for user of PC/2 (about SmallFnt.cmd, STARTUPFOLDERSONLY and           *
  816.  * RUNWORKPLACE statements, and the FAQ file).                                          *
  817.  * Req:                                                                                 *
  818.  *      DisplayLogo                                                                     *
  819.  * Returns:                                                                             *
  820.  *      Success ....... TRUE/FALSE                                                      *
  821. \*--------------------------------------------------------------------------------------*/
  822. DisplayHint: Arg FAQFlag
  823.                                         /* Now inform user about SMALLFNT.CMD */
  824. Call DisplayLogo
  825. Say
  826. Say
  827. Say " "LRed"PC/2"LWhi" also ships a small batch file called "LBro"SmallFnt.cmd"LWhi" which you may use to "
  828. Say " replace the default Proportional System font with a smaller 8 pts. Helv font. "
  829. Say " This batch files modifies your "LBro"OS2.INI"Lwhi" file so that after the next reboot "
  830. Say " most dialogs will be much smaller and more information fits on your screen. "
  831. Say " You may also use the Font Palette to drop the 8 pts. Helv font over the "
  832. Say " titlebar and menu of any application while you hold the ALT-key to make this "
  833. Say " font the default on titlebars and menues.. "
  834. Say
  835. Parse Value SysCurPos() with Row Col
  836. Say " Press any key to continue..."
  837. Col=Col+30
  838. Call SysCurPos Row, Col
  839. Pull Ignore
  840.                                         /* Now inform user about STARTUPFOLDERSONLY */
  841. Call DisplayLogo
  842. Say
  843.                                         /* Search for CONFIG.SYS and the statement
  844.                                            SET RESTARTOBJECTS=STARTUPFOLDERSONLY. Thanks
  845.                                            to Stefan Hora for giving me a drive independent
  846.                                            way to get data from actual CONFIG.SYS */
  847. FoundConfig=FALSE
  848. WorkPlace=strip(Value("RESTARTOBJECTS", , "OS2ENVIRONMENT"))
  849. if POS('STARTUPFOLDERSONLY', WorkPlace)\=0 Then Do
  850.     FoundConfig=TRUE
  851. End
  852.                                         /* Inform the user about CONFIG.SYS */
  853. If FoundConfig=TRUE Then Do
  854.     Say " You have the statement "LBro"SET RESTARTOBJECTS=STARTUPFOLDERSONLY"LWhi" in your"
  855.     Say " "LBro"CONFIG.SYS"LWhi". To enable OS/2 to start "LRed"PC/2"LWhi" during boot, you have to create"
  856.     Say " a shadow of "LRed"PC/2"LWhi" and move it into your startup folder."
  857. End
  858. Else Do
  859.     Say " You don't have the statement "LBro"SET RESTARTOBJECTS=STARTUPFOLDERSONLY"LWhi" in ypur"
  860.     Say " "LBro"CONFIG.SYS"LWhi". OS/2 will start automatically "LRed"PC/2"LWhi" during next boot, if "LRed"PC/2"LWhi" is"
  861.     Say " active before you Shutdown your System."
  862. End
  863. Say
  864. Parse Value SysCurPos() with Row Col
  865. Say " Press any key to continue..."
  866. Col=Col+30
  867. Call SysCurPos Row, Col
  868. Pull Ignore
  869.                                         /* Now inform user about RUNWORKPLACE */
  870. Call DisplayLogo
  871. Say
  872.                                         /* Now search for CONFIG.SYS and the statement
  873.                                            SET RUNWORKPLACE=C:\OS2\PMSHELL.EXE. Again thanks
  874.                                            to Stefan Hora for his drive independent approach */
  875. FoundConfig=FALSE
  876. WorkPlace=strip(Value("RUNWORKPLACE", , "OS2ENVIRONMENT"))
  877. if POS('PMSHELL.EXE', WorkPlace)\=0 Then Do
  878.     FoundConfig=TRUE
  879. End
  880.                                         /* Inform the user about CONFIG.SYS */
  881. If FoundConfig=TRUE Then Do
  882.     Say " You have the statement "LBro"SET RUNWORKPLACE=C:\OS2\PMSHELL.EXE"LWhi" in your"
  883.     Say " "LBro"CONFIG.SYS"LWhi". You may replace the "LBro"WPS"LWhi" by "LRed"PC/2"LWhi", please look into the online"
  884.     Say " help panels of "LRed"PC/2"LWhi" for further information."
  885. End
  886. Else Do
  887.     Say " It seems that you don't run the "LBro"WPS"LWhi" ("LBro"WorkPlace Shell"LWhi"). You may use "LRed"PC/2"LWhi" as"
  888.     Say " a replacement for the WPS by adding to or modifying your "LBro"CONFIG.SYS"LWhi":"
  889.     Say " "LGre"SET RUNWORKPLACE="DestinationDirectory"\PC2.EXE"LWhi
  890.     Say " But be sure that "LRed"PC2HOOK.DLL"LWhi", "LRed"PC2SPOOL.DLL"LWhi" and "LRed"PC2.HLP"LWhi" are in the directory"
  891.     Say " you started "LRed"PC/2"LWhi" from."
  892.     Say " Please look into the online help panels of "LRed"PC/2"LWhi" for further information."
  893. End
  894. Say
  895. Parse Value SysCurPos() with Row Col
  896. Say " Press any key to continue..."
  897. Col=Col+30
  898. Call SysCurPos Row, Col
  899. Pull Ignore
  900.                                         /* Now inform user about FAQ */
  901. If FAQFlag="" Then
  902.     Do
  903.     Call DisplayLogo
  904.     Say
  905.                                         /* Inform the user about safety */
  906.     Say " Don't forget to backup your configuration file regularily to avoid possible"
  907.     Say " damages to your configuration file."
  908.     Say " If you drag a shadow of "LRed"PC/2"LWhi" into the startup folder and have not set"
  909.     Say " "LBro"SET RESTARTOBJECTS=STARTUPFOLDERSONLY"LWhi" in your "LBro"CONFIG.SYS"LWhi" ensure that during"
  910.     Say " loading of the "LBro"WPS"LWhi" "LRed"PC/2"LWhi" is only started by the startup folder to avoid an"
  911.     Say " informational message."
  912.     Say
  913.     Say " If you find this utility useful and want to honor many weeks of work, you are"
  914.     Say " welcome to send me a small donation. Please read the online documentation for"
  915.     Say " further information - Thank you!"
  916.     Say
  917.     Parse Value SysCurPos() with Row Col
  918.     Say " Do you want to read the FAQ (Frequently Asked Questions) list? [Y/y/N/n]: "LGre
  919.                                         /* Ask the user if he wants to read the FAQ */
  920.     Col=Col+75
  921.     Call SysCurPos Row, Col
  922.     Pull FAQFlag
  923.     End
  924. If FAQFlag='Y' Then Do
  925.     Call DisplayLogo
  926.     Command="@Type PC2.faq |more"
  927.     Command
  928.     Say
  929.     Say LWhi"   And now - enjoy! - And now - enjoy! - And now - enjoy! - And Now - enjoy!"
  930.     End
  931. Return "TRUE"
  932.  
  933. /*--------------------------------------------------------------------------------------*\
  934.  * The CTRL+Break signal handler just ignores CTRL+BREAK.                               *
  935.  * Req:                                                                                 *
  936.  *      none                                                                            *
  937.  * Returns:                                                                             *
  938.  *      none                                                                            *
  939. \*--------------------------------------------------------------------------------------*/
  940. SignalHandler:
  941. Return "TRUE"
  942.  
  943.