home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: WPS_PM / WPS_PM.zip / pc2v210.zip / Install.cmd < prev    next >
OS/2 REXX Batch file  |  1999-07-01  |  62KB  |  1,305 lines

  1. /***********************************************************************\
  2.  *                                 PC2.c                               *
  3.  *               Copyright (C) by Stangl Roman, 1993, 1999             *
  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     _VERSION_[]="Install.cmd - PC/2 V2.10"; */
  13.  
  14.                                         /* Register REXX APIs */
  15. Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  16. Call SysLoadFuncs
  17.  
  18.                                         /* CTRL+BREAK signal handler that just ignores any
  19.                                            CTRL+BREAK signal */
  20. /* Call On Halt Name SignalHandler */
  21.  
  22.                                         /* Get the OS/2 Version we are running at */
  23. OS2Version=SysOS2Ver()
  24. Parse Value OS2Version With OS2MajorVersion '.' OS2MinorVersion
  25.                                         /* Get optional commandline parameters (which would
  26.                                            allow a remote installation (CID),  though it is unsupported
  27.                                            I'm confident it will work):
  28.                                            Arg1 ... InstallationOption (I, U, D, P)
  29.                                            Arg2 ... DestinationDirectory (<any path>)
  30.                                            Arg3 ... SubPackagesSelected (P, W, B)
  31.                                            Arg4 ... FilesSelected (A, R, O)
  32.                                            Arg5 ... SingleClickFlag (Y, N)
  33.                                            Arg6 ... ButtonFlag (1, 3)
  34.                                            Arg7 ... SkipQuestionsFlag (Y, N)
  35.                                            Arg8 ... IconRecreateFlag (Y, N) 
  36.                                            E.g. you would specify something like: 
  37.                                                 INSTALL i c:\pc2 p r y 1 n y 
  38.                                            which will install PC/2 (but not WPS 2 PC/2) into c:\pc2
  39.                                            with the minimum required files, using the -SingleClick
  40.                                            flag and button 1 activation, (re)creates and icon on the
  41.                                            Desktop and does not bother the user with questions or
  42.                                            information */
  43. Parse Upper Arg Arg1 Arg2 Arg3 Arg4 Arg5 Arg6 Arg7 Arg8 .
  44.                                         /* Get the full qualified path of our installation
  45.                                            we are running now */
  46. Parse Upper Source . . InstallationFileName
  47.                                         /* Now extract drive and path info terminated
  48.                                            by a backslash */
  49. SourceDirectory=FileSpec('Drive', InstallationFileName)||FileSpec('Path', InstallationFileName)
  50.                                         /* Get \OS2\ directory of boot drive */
  51. OS2Directory=FileSpec('Drive',Value('SYSTEM_INI', , 'OS2ENVIRONMENT'))||'\OS2\'
  52.  
  53. Call AnsiSetup                          /* Setup ANSI colors */
  54. Say LWhi||BBlu                          /* Set highlighted white on blue */
  55. '@Cls'                                  /* Clear screen to set new color */
  56.  
  57.  
  58.                                         /* Ask user what he wants to do, or take
  59.                                            the first commandline arguement when
  60.                                            possible */
  61. InstallationOption=Arg1
  62. If InstallationOption\="I" & InstallationOption\="U" & InstallationOption\="D" & InstallationOption\="P"
  63.     Then Do
  64.     InstallationOption=InstallationMainPanel()
  65.     End
  66. Select
  67.                                         /* If the user wants to quit exit */
  68.     When InstallationOption="Q" Then
  69.         Do
  70.         End
  71.                                         /* If the user wants to install/update PC/2
  72.                                            then get the destination directory, prompt
  73.                                            the user for PC/2, WPS 2 PC/2 or both, update
  74.                                            the files and inform the user */
  75.     When InstallationOption="I" Then
  76.         Do
  77.                                         /* Get the destination directory */
  78.         DestinationDirectory=Arg2
  79.         DestinationDirectory=GetDestinationDirectory(DestinationDirectory)
  80.                                         /* If the user entered QUIT as the destination
  81.                                            directory, because he has to deinstall a
  82.                                            running version of PC/2 first exit */
  83.         If DestinationDirectory="QUIT" Then
  84.             Exit
  85.  
  86.                                             /* Add terminating backslash */
  87.         DestinationDirectory=DestinationDirectory||"\"
  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.                                         /* Now copy files from current directory to
  93.                                            destination directory */
  94.         FilesSelected=Arg4
  95.         CopySuccess=InstallFiles(FilesSelected, SubPackageSelected, SourceDirectory, DestinationDirectory, OS2Directory)
  96.                                         /* Ask user for -SingleClickFlag */
  97.         SingleClickFlag=Arg5
  98.         SingleClickFlag=QueryClickFlag(SingleClickFlag)
  99.                                         /* Ask user for -ButtonFlag */
  100.         ButtonFlag=Arg6
  101.         ButtonFlag=QueryButtonFlag(ButtonFlag)
  102.                                         /* Now recreate WPS Objects */
  103.         SkipQuestionsFlag=Arg7
  104.         IconRecreateFlag=Arg8
  105.         Ignore=CreateWPSObjects(InstallationOption, SubPackageSelected, DestinationDirectory, OS2Directory, SingleClickFlag, ButtonFlag, SkipQuestionsFlag, IconRecreateFlag)
  106.                                         /* Inform user about some usefull things */
  107.         If SkipQuestionsFlag\="Y" Then
  108.             Ignore=DisplayHint(SkipQuestionsFlag)
  109.         End
  110.                                         /* If the user wants to recreate the WPS
  111.                                            Objects of the PC/2 package prompt user
  112.                                            for PC/2, WPS 2 PC/2 or both */
  113.     When InstallationOption="U" Then
  114.         Do
  115.                                         /* Now get the package of PC/2 to install,
  116.                                            either PC/2 (P), WPS 2 PC/2 (W) or both (B) */
  117.         SubPackageSelected=Arg3
  118.         SubPackageSelected=GetSubPackage2Install(SubPackageSelected)
  119.                                         /* Ask user for -SingleClickFlag */
  120.         If (SubPackageSelected="P" | SubPackageSelected="B") Then
  121.             Do
  122.             SingleClickFlag=Arg5
  123.             SingleClickFlag=QueryClickFlag(SingleClickFlag)
  124.                                         /* Ask user for -ButtonFlag */
  125.             ButtonFlag=Arg6
  126.             ButtonFlag=QueryButtonFlag(ButtonFlag)
  127.             End
  128.         Else
  129.             SingleClickFlag=""
  130.                                         /* Now recreate WPS Objects */
  131.         SkipQuestionsFlag=Arg7
  132.         IconRecreateFlag=Arg8
  133.         Ignore=CreateWPSObjects(InstallationOption, SubPackageSelected, SourceDirectory, OS2Directory, SingleClickFlag, ButtonFlag, SkipQuestionsFlag, IconRecreateFlag)
  134.         End
  135.                                         /* If the user wants to delete the WPS program Objects
  136.                                            for PC/2 and WPS 2 PC/2 destroy them */
  137.     When InstallationOption="D" Then
  138.         Do
  139.         Ignore=DeleteWPSObjects("B")
  140.         End
  141.                                         /* If the user wants to delete all files, delete them */
  142.     When InstallationOption="P" Then
  143.         Do
  144.                                         /* Purge all PC/2 files in the current directory and all
  145.                                            WPS 2 PC/2 files in the \OS2\ subdirectory */
  146.         Ignore=PurgeFiles(SourceDirectory, OS2Directory)
  147.         End
  148. End
  149.                                         /* Change to the drive where we installed from */
  150. Command="@"Filespec("Drive", SourceDirectory)" >NUL"
  151. Command
  152.                                         /* Change in the directory (no trailing \ except for
  153.                                            root directory) */
  154. Command="@CD "Strip(Filespec("Path", SourceDirectory), T, "\")
  155. If Command="@CD " Then
  156.     Command=Command||"\"
  157. Command=Command||" >NUL"
  158. Command
  159. Say LWhi
  160. Say "   And now - enjoy! - And now - enjoy! - And now - enjoy! - And now - enjoy!"
  161. Say Non||Whi||BBla
  162. Exit
  163.  
  164. /*--------------------------------------------------------------------------------------*\
  165.  * Setup ANSI colors                                                                    *
  166.  * Req:                                                                                 *
  167.  *      none                                                                            *
  168.  * Returns:                                                                             *
  169.  *      none                                                                            *
  170. \*--------------------------------------------------------------------------------------*/
  171. AnsiSetup:
  172.                                         /* ANSI control */
  173. Esc=d2c(27)d2c(91)
  174.                                         /* Attributes */
  175. Bli=Esc'5m'
  176. Und=Esc'4m'
  177. Hig=Esc'1m'
  178. Non=Esc'0m'
  179.                                         /* Foreground colors */
  180. Bla=Esc'30m'
  181. Red=Esc'31m'
  182. Gre=Esc'32m'
  183. Bro=Esc'33m'
  184. Blu=Esc'34m'
  185. Cya=Esc'35m'
  186. Tur=Esc'36m'
  187. Whi=Esc'37m'
  188. LBla=Hig||Esc'30m'
  189. LRed=Hig||Esc'31m'
  190. LGre=Hig||Esc'32m'
  191. LBro=Hig||Esc'33m'
  192. LBlu=Hig||Esc'34m'
  193. LCya=Hig||Esc'35m'
  194. LTur=Hig||Esc'36m'
  195. LWhi=Hig||Esc'37m'
  196.                                         /* Background colors */
  197. BBla=Esc'40m'
  198. BRed=Esc'41m'
  199. BGre=Esc'42m'
  200. BBro=Esc'43m'
  201. BBlu=Esc'44m'
  202. BCya=Esc'45m'
  203. BTur=Esc'46m'
  204. BWhi=Esc'47m'
  205. Return
  206.  
  207. /*--------------------------------------------------------------------------------------*\
  208.  * Copy files from current directory to destination directory                           *
  209.  * Req:                                                                                 *
  210.  *      FileName ...... File to copy                                                    *
  211.  *      CopyDirectory . Directory to copy to                                            *
  212.  * Returns:                                                                             *
  213.  *      Success ....... TRUE/FALSE                                                      *
  214. \*--------------------------------------------------------------------------------------*/
  215. FileCopy: Arg FileName, CopyDirectory1, CopyDirectory2
  216. Success="TRUE"
  217. Parse Value SysCurPos() with Row Col
  218. If CopyDirectory2="" Then
  219.     Do
  220.     Say " Copying "FileName" to "CopyDirectory1
  221.     Command='@Copy 'FileName' 'CopyDirectory1' /v >NUL 2>NUL'
  222.     Command
  223.     If rc\=0 Then
  224.         Success="FALSE"
  225.     End
  226. Else
  227.     Do
  228.     Say " Copying "FileName" to "CopyDirectory1" , "CopyDirectory2
  229.     Command='@Copy 'FileName' 'CopyDirectory1' /v >NUL 2>NUL'
  230.     Command
  231.     If rc\=0 Then
  232.         Success="FALSE"
  233.     Command='@Copy 'FileName' 'CopyDirectory2' /v >NUL 2>NUL'
  234.     Command
  235.     If rc\=0 Then
  236.         Success="FALSE"
  237.     End
  238. Col=Col+60
  239. Call SysCurPos Row, Col
  240. If Success="TRUE" Then
  241.     Say "Copied"
  242. Else
  243.     Say LBro"Failed"LWhi
  244. Return Success
  245.  
  246. /*--------------------------------------------------------------------------------------*\
  247.  * Delete files at the source directory.                                                *
  248.  * Req:                                                                                 *
  249.  *      FileName ...... File to delete                                                  *
  250.  *      DeleteDirectory Directory to delete from                                        *
  251.  * Returns:                                                                             *
  252.  *      Success ....... TRUE/FALSE                                                      *
  253. \*--------------------------------------------------------------------------------------*/
  254. FileDelete: Arg FileName, DeleteDirectory1, DeleteDirectory2
  255. Success="TRUE"
  256. Parse Value SysCurPos() with Row Col
  257. If DeleteDirectory2="" Then
  258.     Do
  259.     Say " Deleting "FileName" from "DeleteDirectory1
  260.     Command='@Del 'DeleteDirectory1||FileName' >NUL 2>NUL'
  261.     Command
  262.     If rc\=0 Then
  263.         Success="FALSE"
  264.     End
  265. Else
  266.     Do
  267.     Say " Deleting "FileName" from "DeleteDirectory1" , "DeleteDirectory2
  268.     Command='@Del 'DeleteDirectory1||FileName' >NUL 2>NUL'
  269.     Command
  270.     If rc\=0 Then
  271.         Success="FALSE"
  272.     Command='@Del 'DeleteDirectory2||FileName' >NUL 2>NUL'
  273.     Command
  274.     If rc\=0 Then
  275.         Success="FALSE"
  276.     End
  277. Col=Col+60
  278. Call SysCurPos Row, Col
  279. If Success="TRUE" Then
  280.     Say "Deleted"
  281. Else
  282.     Say LBro"Failed"LWhi
  283. Return Success
  284.  
  285. /*--------------------------------------------------------------------------------------*\
  286.  * Display the logo lines                                                               *
  287.  * Req:                                                                                 *
  288.  *      none                                                                            *
  289.  * Returns:                                                                             *
  290.  *      none                                                                            *
  291. \*--------------------------------------------------------------------------------------*/
  292. DisplayLogo:
  293. Say LWhi||BBlu
  294. '@Cls'
  295. Say
  296. Say "                 "LRed"PC/2 - Program Commander/2  Version 2.10 for"LWhi
  297. Say "          "LRed"IBM OS/2 2.x, OS/2 WARP, WARP Srv. SMP Presentation Manager"LWhi
  298. Say "                    "LRed"Copyright (C) by Roman Stangl July, 1999"LWhi
  299. Return
  300.  
  301. /*--------------------------------------------------------------------------------------*\
  302.  * Display the the main panel of PC/2's installation.                                   *
  303.  * Req:                                                                                 *
  304.  *      DisplayLogo                                                                     *
  305.  * Returns:                                                                             *
  306.  *      I/D/P/Q                                                                         *
  307. \*--------------------------------------------------------------------------------------*/
  308. InstallationMainPanel:
  309. Do Until (InstallationOption="I" | InstallationOption="U" | InstallationOption="D" | InstallationOption="P" | InstallationOption="Q")
  310.     Call DisplayLogo
  311.     Say
  312.     Say " "LGre"I"LWhi" ... Select this choice to install a new version, or to update an existing"
  313.     Say "       version of the "LRed"PC/2"LWhi" package (containing the subpackages "LRed"PC/2"LWhi" and "
  314.     Say "       "LRed"WPS 2 PC/2"LWhi") on your system."
  315.     Say
  316.     Say " "LGre"U"LWhi" ... Select this option to recreate accidentially deleted WPS program"
  317.     Say "       Objects for "LRed"PC/2"LWhi" and/or "LRed"WPS 2 PC/2"LWhi" programs on your Desktop."
  318.     Say
  319.     Say " "LGre"D"LWhi" ... Select this choice to delete the WPS Objects created by the "LRed"PC/2"LWhi
  320.     Say "       Installation program. After deleting these Objects some files are locked"
  321.     Say "       until the next reboot. Therefore after the next reboot you may want to"
  322.     Say "       continue with the "LGre"P"LWhi"urge option, to completely remove the files from"
  323.     Say "       your disk."
  324.     Say
  325.     Say " "LGre"P"LWhi" ... Select this choice to delete all files of the "LRed"PC/2"LWhi" package from your"
  326.     Say "       disk."
  327.     Say
  328.     Say " "LGre"Q"LWhi" ... Quit Installation without any changes."
  329.     Say
  330.     Parse Value SysCurPos() with Row Col
  331.     Say " Please enter your selection and press the Enter key:"LGre
  332.                                             /* Prompt the user for a selection and
  333.                                                return it */
  334.     Col=Col+54
  335.     Call SysCurPos Row, Col
  336.     Pull InstallationOption
  337. End
  338. Return InstallationOption
  339.  
  340. /*--------------------------------------------------------------------------------------*\
  341.  * Request the directory to install PC/2 into and create it.                            *
  342.  * Req:                                                                                 *
  343.  *      DisplayLogo                                                                     *
  344.  * Returns:                                                                             *
  345.  *      Directory to copy PC/2's files into                                             *
  346. \*--------------------------------------------------------------------------------------*/
  347. GetDestinationDirectory: Arg DestinationDirectory
  348. If DestinationDirectory\="" Then
  349.     Do
  350.                                             /* Test for installation directory */
  351.     Call SysFileTree DestinationDirectory, FileDirectory, 'D'
  352.     If FileDirectory.0='0' Then
  353.         Do
  354.                                             /* Make the installation directory */
  355.         Rc=SysMkDir(DestinationDirectory)
  356.         If Rc\=0 Then
  357.             DestinationDirectory=""
  358.         End
  359.     End
  360. Do While DestinationDirectory=""
  361.     Call DisplayLogo
  362.     Say
  363.     Say " You selected to install a new version, or update an existing version of "LRed"PC/2"LWhi":"
  364.     Say
  365.     Say " *) If a version of "LRed"PC/2"LWhi" is currently running, then please close it now!"
  366.     Say
  367.     Say " *) If you have already installed "LRed"WPS 2 PC/2"LWhi" please run the deinstallation"
  368.     Say "    process of that version. These steps are required, because otherwise"
  369.     Say "    files that are going to be updated are locked and installation will abort."
  370.     Say
  371.     Say " *) If you are ready to continue installation, please enter the destination "
  372.     Say "    directory to install "LRed"PC/2"LWhi" into, or enter "LGre"Quit"LWhi" to abort installation."
  373.     Say
  374.     Say " Please specify the directory you want to install "LRed"PC/2"lWhi" into. As "LRed"PC/2"LWhi" does not"
  375.     Say " require any changes in CONFIG.SYS, a unique directory name is suggested."
  376.     Say " Example for an installation directory: "LGre"C:\PMAPPS\PC2"LWhi
  377.     Say
  378.     Parse Value SysCurPos() with Row Col
  379.     Say " Please enter installation directory: "LGre
  380.     Col=Col+38
  381.     Call SysCurPos Row, Col
  382.     Pull DestinationDirectory
  383.                                             /* Test for installation directory */
  384.     Call SysFileTree DestinationDirectory, FileDirectory, 'D'
  385.     If (FileDirectory.0='0' & Right(DestinationDirectory, 1)\=":") Then
  386.         Do
  387.                                             /* Make the installation directory */
  388.         Rc=SysMkDir(DestinationDirectory)
  389.         If Rc\=0 Then
  390.             Do
  391.             Say LBro
  392.             Say " "LBro"Sorry, the desired directory couldn't be created, please correct your"
  393.             Parse Value SysCurPos() with Row Col
  394.             Say " input! Press the Enter key to retry..."
  395.             Col=Col+40
  396.             Call SysCurPos Row, Col
  397.             Pull Ignore
  398.             DestinationDirectory=""
  399.             End
  400.     End
  401. End
  402. Return DestinationDirectory
  403.  
  404. /*--------------------------------------------------------------------------------------*\
  405.  * Prompt the user for the PC/2 subpackage to install/recreate. This may be PC/2,       *
  406.  * WPS 2 PC/2 or both.                                                                  *
  407.  * Req:                                                                                 *
  408.  *      DisplayLogo                                                                     *
  409.  * Returns:                                                                             *
  410.  *      P/W/B                                                                           *
  411. \*--------------------------------------------------------------------------------------*/
  412. GetSubPackage2Install: Arg SubPackageSelected
  413. Call DisplayLogo
  414. Do While (SubPackageSelected\="P" & SubPackageSelected\="W" & SubPackageSelected\="B")
  415.     Call DisplayLogo
  416.     Say
  417.     Say " "LGre"P"LWhi" ... Install or update "LRed"PC/2"LWhi
  418.     Say
  419.     Say "       Select this choice to install/recreate the "LRed"PC/2"LWhi" WPS program object of"
  420.     Say "       the "LRed"PC/2"LWhi" package."
  421.     Say
  422.     Say " "LGre"W"LWhi" ... Install or update "LRed"WPS 2 PC/2"LWhi
  423.     Say
  424.     Say "       Select this choice to install/recreate the "LRed"WPS 2 PC2"LWhi" WPS program object"
  425.     Say "       of the WPS of the "LRed"PC/2"LWhi" package. "LRed"WPS 2 PC2"LWhi" allows to to extract WPS"
  426.     Say "       programs, folders and objects into "LRed"PC/2"LWhi"'s Popup Menu easily by using"
  427.     Say "       Drag & Drop."
  428.     Say
  429.     Say " "LGre"B"LWhi" ... Install or update both programs"
  430.     Say
  431.     Say "       Select this choice to install/recreate both program objects onto the"
  432.     Say "       WPS."
  433.     Say
  434.     Parse Value SysCurPos() with Row Col
  435.     Say " Please enter your selection and press the Enter key:"LGre
  436.                                             /* Prompt the user for a selection and
  437.                                                return it */
  438.     Col=Col+54
  439.     Call SysCurPos Row, Col
  440.     Pull SubPackageSelected
  441. End
  442. Return SubPackageSelected
  443.  
  444. /*--------------------------------------------------------------------------------------*\
  445.  * Copy all required files to the installation destination directory, Take care not to  *
  446.  * overwrite a PC2.cfg configuration file.                                              *
  447.  * Req:                                                                                 *
  448.  *      DisplayLogo                                                                     *
  449.  * Returns:                                                                             *
  450.  *      Success ....... TRUE/FALSE                                                      *
  451. \*--------------------------------------------------------------------------------------*/
  452. InstallFiles: Arg FilesSelected, SubPackageSelected, SourceDirectory, DestinationDirectory, OS2Directory
  453.                                         /* Ask user if he only wants to leave out the optionl
  454.                                            files */
  455. If (FilesSelected\="A" & FilesSelected\="R" & FilesSelected\="O") Then Do
  456.     Call DisplayLogo
  457.     Say
  458.     Say " The "LRed"PC/2"LWhi" package contains files, that are not required to run it, but give"
  459.     Say " you some ideas how to configure and use "LRed"PC/2"LWhi". The following files are only"
  460.     Say " optional, and can be skipped to save disk space:"
  461.     Say 
  462.     Say " PC2.doc, History.doc .... Current and previous release feature description"
  463.     Say " TrapInfo.doc ............ Skeleton to report bugs (part of online help too)"
  464.     Say " PC2-*.faq ............... Frequently asked questions (part of online help too)"
  465.     Say " Tutorial.zip ............ A introductional Tutorial for novice users"
  466.     Say " Source.zie, Protect.exe . Source code of "LRed"PC/2"LWhi" and source decryption"
  467.     Say
  468.     Say " "LGre"A"LWhi" ... Install all files (recommended and default option)"
  469.     Say
  470.     Say " "LGre"R"LWhi" ... Install only required files"
  471.     Say
  472.     Say " "LGre"O"LWhi" ... Install only optional files"
  473.     Say
  474.     Parse Value SysCurPos() with Row Col
  475.     Say " Please enter your selection and press the Enter key:"LGre
  476.                                         /* Prompt the user for a selection and
  477.                                            return it */
  478.     Col=Col+54
  479.     Call SysCurPos Row, Col
  480.     Pull FilesSelected
  481.     If (FilesSelected\="A" & FilesSelected\="R" & FilesSelected\="O") Then
  482.         FilesSelected="A"
  483. End
  484. CopySuccess="TRUE"
  485. CopyAbort="FALSE"
  486.                                         /* Now copy files (12 files per page) */
  487. Call DisplayLogo
  488. Say
  489. Say " Now copying files (part 1 of 3)..."
  490. Say
  491. If (SubPackageSelected="P" | SubPackageSelected="B") Then
  492.     Do
  493.     If (FilesSelected="A" | FilesSelected="R") Then
  494.         If FileCopy('PC2.EXE', DestinationDirectory)="FALSE" Then
  495.             CopyAbort="TRUE"
  496.     If (FilesSelected="A" | FilesSelected="R") Then
  497.         If FileCopy('PC2HOOK.DLL', DestinationDirectory)="FALSE" Then
  498.             CopyAbort="TRUE"
  499.     If (FilesSelected="A" | FilesSelected="R") Then
  500.         If FileCopy('PC2SPOOL.DLL', DestinationDirectory)="FALSE" Then
  501.             CopyAbort="TRUE"
  502.     If (FilesSelected="A" | FilesSelected="R") Then
  503.         If FileCopy('PC2NET.DLL', DestinationDirectory)="FALSE" Then
  504.             CopyAbort="TRUE"
  505.                                         /* The resource DLLs are OS/2 version dependent */
  506.     If (OS2MajorVersion>2) | ((OS2MajorVersion=2) & (OS2MinorVersion>=40)) Then Do 
  507.         If (FilesSelected="A" | FilesSelected="R") Then
  508.             If FileCopy('PC2BRES.DL4', DestinationDirectory||'PC2BRes.dll')="FALSE" Then
  509.                 CopyAbort="TRUE"
  510.         If (FilesSelected="A" | FilesSelected="R") Then
  511.             If FileCopy('PC2VRES.DL4', DestinationDirectory||'PC2VRes.dll')="FALSE" Then
  512.                 CopyAbort="TRUE"
  513.         End
  514.     Else Do
  515.         If (FilesSelected="A" | FilesSelected="R") Then
  516.             If FileCopy('PC2BRES.DL3', DestinationDirectory||'PC2BRes.dll')="FALSE" Then
  517.                 CopyAbort="TRUE"
  518.         If (FilesSelected="A" | FilesSelected="R") Then
  519.             If FileCopy('PC2VRES.DL3', DestinationDirectory||'PC2VRes.dll')="FALSE" Then
  520.                 CopyAbort="TRUE"
  521.         End
  522.     If (FilesSelected="A" | FilesSelected="R") Then
  523.         If FileCopy('PC2.HLP', DestinationDirectory)="FALSE" Then
  524.             CopyAbort="TRUE"
  525.     If (FilesSelected="A" | FilesSelected="R") Then
  526.         If FileCopy('INSTALL.CMD', DestinationDirectory)="FALSE" Then
  527.             CopyAbort="TRUE"
  528.     If (FilesSelected="A" | FilesSelected="O") Then
  529.         If FileCopy('PC2.DOC', DestinationDirectory)="FALSE" Then
  530.             CopySuccess="FALSE"
  531.     If (FilesSelected="A" | FilesSelected="O") Then
  532.         If FileCopy('HISTORY.DOC', DestinationDirectory)="FALSE" Then
  533.             CopySuccess="FALSE"
  534.     If (FilesSelected="A" | FilesSelected="O") Then
  535.         If FileCopy('TRAPINFO.DOC', DestinationDirectory)="FALSE" Then
  536.             CopySuccess="FALSE"
  537. /*
  538.  *    If (FilesSelected="A" | FilesSelected="O") Then
  539.  *        If FileCopy('SURVEY.DOC', DestinationDirectory)="FALSE" Then
  540.  *            CopySuccess="FALSE"
  541.  */
  542.     If FileCopy('SYSLEVEL.PC2', DestinationDirectory)="FALSE" Then
  543.         CopySuccess="FALSE"
  544.                                         /* May exit here */
  545.     CopySuccess=TestCopySuccess(CopySuccess, CopyAbort)
  546.     Call DisplayLogo
  547.     Say
  548.     Say " Now copying files (part 2 of 3)..."
  549.     Say
  550.     If (FilesSelected="A" | FilesSelected="O") Then
  551.         If FileCopy('PC2-1.FAQ', DestinationDirectory)="FALSE" Then
  552.             CopySuccess="FALSE"
  553.     If (FilesSelected="A" | FilesSelected="O") Then
  554.         If FileCopy('PC2-2.FAQ', DestinationDirectory)="FALSE" Then
  555.             CopySuccess="FALSE"
  556.     If (FilesSelected="A" | FilesSelected="O") Then
  557.         If FileCopy('PC2-3.FAQ', DestinationDirectory)="FALSE" Then
  558.             CopySuccess="FALSE"
  559.     If (FilesSelected="A" | FilesSelected="O") Then
  560.         If FileCopy('SMALLFNT.CMD', DestinationDirectory)="FALSE" Then
  561.             CopySuccess="FALSE"
  562.     If (FilesSelected="A" | FilesSelected="O") Then
  563.         If FileCopy('PMCOLOR.CMD', DestinationDirectory)="FALSE" Then
  564.             CopySuccess="FALSE"
  565.     If (FilesSelected="A" | FilesSelected="O") Then
  566.         If FileCopy('TUTORIAL.ZIP', DestinationDirectory)="FALSE" Then
  567.             CopySuccess="FALSE"
  568.     If (FilesSelected="A" | FilesSelected="O") Then
  569.         If FileCopy('SOURCE.ZIE', DestinationDirectory)="FALSE" Then
  570.             CopySuccess="FALSE"
  571.     If (FilesSelected="A" | FilesSelected="O") Then
  572.         If FileCopy('PROTECT.EXE', DestinationDirectory)="FALSE" Then
  573.             CopySuccess="FALSE"
  574.                                         /* Test for existing PC2.cfg */
  575.     Call SysFileTree DestinationDirectory||"PC2.cfg", File, 'F'
  576.     If File.0='0' Then
  577.         Do
  578.         If FileCopy('PC2.cfg', DestinationDirectory)="FALSE" Then
  579.             CopySuccess="FALSE"
  580.         End
  581.     Else
  582.         Do
  583.         Parse Value SysCurPos() with Row Col
  584.         Say " Found existing PC2.CFG at "DestinationDirectory
  585.         Col=Col+60
  586.         Call SysCurPos Row, Col
  587.         Say LBro"Skipped"LWhi
  588.         End
  589.                                         /* Test for existing PC2.ini */
  590.     Call SysFileTree DestinationDirectory||"PC2.ini", File, 'F'
  591.     If File.0='0' Then
  592.         Do
  593.         If FileCopy('PC2.ini', DestinationDirectory)="FALSE" Then
  594.             CopySuccess="FALSE"
  595.         End
  596.     Else
  597.         Do
  598.         Parse Value SysCurPos() with Row Col
  599.         Say " Found existing PC2.INI at "DestinationDirectory
  600.         Col=Col+60
  601.         Call SysCurPos Row, Col
  602.         Say LBro"Skipped"LWhi
  603.         End
  604.     End
  605.                                         /* Test for existing PC2.env */
  606. Call SysFileTree DestinationDirectory||"PC2.env", File, 'F'
  607. If File.0='0' Then
  608.     Do
  609.     If FileCopy('PC2.env', DestinationDirectory)="FALSE" Then
  610.         CopySuccess="FALSE"
  611.     End
  612. Else
  613.     Do
  614.     Parse Value SysCurPos() with Row Col
  615.     Say " Found existing PC2.ENV at "DestinationDirectory
  616.     Col=Col+60
  617.     Call SysCurPos Row, Col
  618.     Say LBro"Skipped"LWhi
  619.     End
  620.                                         /* May exit here */
  621. CopySuccess=TestCopySuccess(CopySuccess, CopyAbort)
  622. Call DisplayLogo
  623. Say
  624. Say " Now copying files (part 3 of 3)..."
  625. Say
  626. If (SubPackageSelected="W" | SubPackageSelected="B") Then
  627.     Do
  628.     If FileCopy('WPS2PC2.DLL', DestinationDirectory, OS2Directory||"DLL\")="FALSE" Then
  629.         CopyAbort="TRUE"
  630.     If FileCopy('WPS2PC2.HLP', DestinationDirectory, OS2Directory||"HELP\")="FALSE" Then
  631.         CopyAbort="TRUE"
  632.     End
  633.                                         /* May exit here */
  634. CopySuccess=TestCopySuccess(CopySuccess, CopyAbort)
  635. Return CopySuccess
  636.  
  637. /*--------------------------------------------------------------------------------------*\
  638.  * According to the parameters passed, inform user about the success of the file copy   *
  639.  * operations during installation.                                                      *
  640.  * Req:                                                                                 *
  641.  *      CopySuccess, CopyAbort                                                          *
  642.  * Returns:                                                                             *
  643.  *      Success ....... TRUE                                                            *
  644. \*--------------------------------------------------------------------------------------*/
  645. TestCopySuccess: Arg CopySuccess, CopyAbort
  646. If (CopySuccess="FALSE" | CopyAbort="TRUE") Then
  647.     Do
  648.     Say
  649.     If CopyAbort="TRUE" Then Do
  650.                                         /* Fatal error, abort installation */           
  651.         Say " Fatal error(s) detected - Be sure that you are not running another copy of"
  652.         Say " "LRed"PC/2"LWhi". Files may also be locked by other applications (e.g. IBM Communication"
  653.         Say " Manager/2), you may stop some applications or reboot. Press the Enter key to"
  654.         Say " abort the installation... "
  655.         Parse Value SysCurPos() with Row Col
  656.         Row=Row-1
  657.         Col=Col+27
  658.         Call SysCurPos Row, Col
  659.         Pull Ignore
  660.         Say Non||Whi||BBla
  661.         Exit
  662.         End
  663.     Else Do
  664.                                         /* Minor error, inform user */      
  665.         Parse Value SysCurPos() with Row Col
  666.         Say " Minor error(s) detected - press the Enter key to continue..."
  667.         Col=Col+62
  668.         Call SysCurPos Row, Col
  669.         Pull Ignore
  670.     End
  671.     CopySuccess='TRUE'
  672.     End
  673. Else
  674.     Call SysSleep 1
  675. Return "TRUE"
  676.  
  677. /*--------------------------------------------------------------------------------------*\
  678.  * Ask the user for the -SingleClick flag instead of the default -DoubleClick.          *
  679.  * Req:                                                                                 *
  680.  *      DisplayLogo                                                                     *
  681.  * Returns:                                                                             *
  682.  *      SingleClickFlag Y/N                                                             *
  683. \*--------------------------------------------------------------------------------------*/
  684.                                         /* Now ask the user for -SingleClick flag */
  685. QueryClickFlag: Arg SingleClickFlag
  686. Do While (SingleClickFlag\="Y" & SingleClickFlag\="N")
  687.     Call DisplayLogo
  688.                                         /* Ask the user if he wants to display the Popup-
  689.                                            Menu after a single-click instead of a double-
  690.                                            click with mouse button 1 */
  691.     Say
  692.     Say LWhi" Please note that non-default parameters will be added to "LRed"PC/2"LWhi"'s WPS"
  693.     Say " Object and will take precedence over the options saved with the setup "
  694.     Say " dialogs. You may have to change the commandline parameters at the WPS "
  695.     Say " Object to remove that overrides."
  696.     Say
  697.     Say " Do you want the "LRed"PC/2"LWhi"'s Popup-Menu displayed after a single-click with mouse"
  698.     Say " button 1 instead of the default double click, this will also overwrite any"
  699.     Say " changes you make within PC/2 at the next restart (please refer to the online"
  700.     Say " documentation about this and the other optional commandline parameters of"
  701.     Say " "LRed"PC/2"LWhi")? [N/n"Non||Whi||BBlu"/Y/y"LWhi"]: "LGre
  702.     Parse Value SysCurPos() with Row Col
  703.     Row=Row-1
  704.     Col=Col+19
  705.     Call SysCurPos Row, Col
  706.     Pull SingleClickFlag
  707.     If SingleClickFlag="" Then
  708.         SingleClickFlag="N"
  709. End
  710. Say LWhi
  711. Return SingleClickFlag
  712.  
  713. /*--------------------------------------------------------------------------------------*\
  714.  * Ask the user for the -Button3 flag instead of the default -Button1.                  *
  715.  * Req:                                                                                 *
  716.  *      QueryClickFlag                                                                  *
  717.  * Returns:                                                                             *
  718.  *      ButtonFlag 1/3                                                                  *
  719. \*--------------------------------------------------------------------------------------*/
  720.                                         /* Now ask the user for -Button3 flag */
  721. QueryButtonFlag: Arg ButtonFlag
  722. Parse Value SysCurPos() with SaveRow SaveCol
  723. Do While (ButtonFlag\="1" & ButtonFlag\="3" & ButtonFlag\="@")
  724.     Call SysCurPos SaveRow, SaveCol
  725.                                         /* Ask the user if he wants to display the Popup-
  726.                                            Menu with button 3 instread of 1 */
  727.     Say LWhi" Do you want to use button 3 to launch the Popup-Menu and for Advanced"
  728.     Say " Marking instead of the default button 1, this will also overwrite any"
  729.     Say " changes you make within PC/2 at the next restart (please refer to the online"
  730.     Say " documentation about this and the other optional commandline parameters of"
  731.     Say " "LRed"PC/2"LWhi")? [1"Non||Whi||BBlu"/3"LWhi"]: "LGre
  732.     Parse Value SysCurPos() with Row Col
  733.     Row=Row-1
  734.     Col=Col+15
  735.     Call SysCurPos Row, Col
  736.     Pull ButtonFlag
  737.     If ButtonFlag="" Then
  738.         ButtonFlag="1"
  739. End
  740. Say LWhi
  741. Return ButtonFlag
  742.  
  743. /*--------------------------------------------------------------------------------------*\
  744.  * Create the WPS Objects of PC/2 and/or WPS 2 PC/2.                                    *
  745.  * Req:                                                                                 *
  746.  *      DisplayLogo                                                                     *
  747.  * Returns:                                                                             *
  748.  *      Success ....... TRUE/FALSE                                                      *
  749. \*--------------------------------------------------------------------------------------*/
  750. CreateWPSObjects: Arg InstallationOption, SubPackageSelected, RunDirectory, OS2Directory, SingleClickFlag, ButtonFlag, SkipQuestionsFlag
  751.                                         /* Form PC/2 setup string */
  752. Parameters=""
  753. If SingleClickFlag='Y' | SingleClickFlag='y' Then
  754.     Do
  755.                                         /* Add -SingleClick to the parameters field, -DoubleClick
  756.                                            is the default */
  757.     Parameters="-SingleClick "
  758.     End
  759. If ButtonFlag='3' Then
  760.     Do
  761.                                         /* Add -Button3 to the parameters field, -Button1
  762.                                            is the default */
  763.     Parameters=Parameters||"-Button3 "
  764.     End
  765. PC2SetupString="EXENAME="RunDirectory"\PC2.EXE;STARTUPDIR="RunDirectory";PARAMETERS="Parameters";OBJECTID=<WP_PC2>"
  766.                                         /* Now create/recreate WPS Objects */
  767. Call DisplayLogo
  768. Say
  769.                                         /* Ask the user if he wants to create icons, which means that
  770.                                            the existing ones may be deleted (e.g. from the Startup
  771.                                            folder) and replaced by ones on the Desktop */
  772. If SkipQuestionsFlag\="Y" Then 
  773.     Do
  774.     Parse Value SysCurPos() with SaveRow SaveCol
  775.     Do While (IconRecreateFlag\="Y" & IconRecreateFlag\="N")
  776.         Call SysCurPos SaveRow, SaveCol
  777.         Say LWhi" Do you want to the installation create "LRed"PC/2"LWhi" icons on the Desktop, replacing"
  778.         Say " icons you may already have configured (e.g. in the Startup folder) from a"
  779.         Say " previous installation? [Y/y"Non||Whi||BBlu"/N/n"LWhi"]: "LGre
  780.         Parse Value SysCurPos() with Row Col
  781.         Row=Row-1
  782.         Col=Col+35
  783.         Call SysCurPos Row, Col
  784.         Pull IconRecreateFlag
  785.         If IconRecreateFlag="" Then
  786.             IconRecreateFlag="Y"
  787.     End
  788.     Say LWhi
  789.     End
  790. If InstallationOption\="U" Then
  791.     Do
  792.     If SkipQuestionsFlag\="Y" Then 
  793.         Do
  794.         Say " Now starting "LRed"PC/2"LWhi" from "RunDirectory"..."
  795.         Say
  796.                                         /* Change to the drive where we installed from */
  797.         Command="@"Filespec("Drive", RunDirectory)" >NUL"
  798.         Command
  799.                                         /* Change in the installation directory */
  800.         Command="@CD "||Strip(Filespec("Path", RunDirectory), T, "\")||" >NUL"
  801.         Command
  802.                                         /* Now we start PC/2 with help, but check for
  803.                                            the clicking method */
  804.         Command="@Start PC2.exe "Parameters" -INSTALL"
  805.         Command
  806.         If rc\=0 Then
  807.             Do
  808.             Say " Sorry, I couldn't start "LRed"PC/2"LWhi" for you..."
  809.             End
  810.         Else
  811.             Do
  812.             Say " After you have finished reading all help panels exit "LRed"PC/2"LWhi" and restart it by"
  813.             Say " clicking on the Desktop with mouse button 1. You will notice that the back-"
  814.             Say " ground behind the icon changed its color and shape if "LRed"PC/2"LWhi" is started."
  815.             End
  816.         Say
  817.         Parse Value SysCurPos() with Row Col
  818.         Say " Press the Enter key to continue..."
  819.         Col=Col+36
  820.         Call SysCurPos Row, Col
  821.         Pull Ignore
  822.         Say
  823.                                         /* Change to the drive where we installed from */
  824.         Command="@"Filespec("Drive", SourceDirectory)" >NUL"
  825.         Command
  826.                                         /* Change in the directory */
  827.         Command="@CD "Strip(Filespec("Path", SourceDirectory), T, "\")" >NUL"
  828.         Command
  829.         End
  830.     End
  831. Say " Now creating WPS Objects for "LRed"PC/2"LWhi" and/or "LRed"WPS 2 PC/2"LWhi"..."
  832. Say
  833. Success="TRUE"
  834.                                         /* Create PC/2 Object */
  835. If (SubPackageSelected="P" | SubPackageSelected="B") Then
  836.     Do
  837.     If IconRecreateFlag='Y' | IconRecreateFlag='y' Then
  838.         Do
  839.         Parse Value SysCurPos() with Row Col
  840.         Call SysCurPos Row, Col
  841.         Say " Installing WPS Object of "LRed"PC/2"LWhi
  842.         Col=Col+40
  843.         Call SysCurPos Row, Col
  844.                                         /* Now create the PC/2 object on the Desktop */
  845.         Rc=SysCreateObject('WPProgram', 'PC/2', '<WP_DESKTOP>', PC2SetupString, 'ReplaceIfExists')
  846.         If Rc<>1 Then
  847.             Do
  848.             Say "SysCreateObject failed"
  849.             Row=Row+1
  850.             Success="FALSE"
  851.             End
  852.         Else
  853.             Do
  854.             Say "SysCreateObject ok"
  855.             Row=Row+1
  856.             End
  857.         Say
  858.         End
  859.     End
  860.                                         /* Create/recreate WPS 2 PC/2 Object */
  861. If (SubPackageSelected="W" | SubPackageSelected="B") Then
  862.     Do
  863.     If FileCopy(WPS2PC2.DLL, OS2Directory||"DLL\")="FALSE" Then
  864.         CopySuccess="FALSE"
  865.     If FileCopy(WPS2PC2.HLP, OS2Directory||"HELP\")="FALSE" Then
  866.         CopySuccess="FALSE"
  867.                                         /* We have to rename WPS 2 PC/2's DLL otherwise
  868.                                            it will be locked (by WPS or WPS2PC2.dll itself ?),
  869.                                            possibly when having .; in the LIBPATH */
  870.     Command="@Ren WPS2PC2.dll WPS2PC2.dl_"
  871.     Command
  872.     Command="@Ren WPS2PC2.hlp WPS2PC2.hl_"
  873.     Command
  874.     Say
  875.     Parse Value SysCurPos() with Row Col
  876.     Say " Installing WPS Object of "LRed"WPS 2 PC/2"LWhi
  877.     Call SysCurPos Row, Col
  878.     Col=Col+40
  879.     Call SysCurPos Row, Col
  880.     Rc=SysRegisterObjectClass('Wps2Pc2', OS2Directory||'\DLL\WPS2PC2.DLL');
  881.     If Rc<>1 Then
  882.         Do
  883.         Say "SysRegisterObjectClass failed"
  884.         Row=Row+1
  885.         Success="FALSE"
  886.         End
  887.     Else
  888.         Do
  889.         Say "SysRegisterObjectClass ok"
  890.         Row=Row+1
  891.         End
  892.     Call SysCurPos Row, Col
  893.     If IconRecreateFlag='Y' | IconRecreateFlag='y' Then
  894.         Do
  895.         SetupString='OBJECTID=<WP_WPS2PC2>;'
  896.         Rc=SysCreateObject('Wps2Pc2', 'WPS 2 PC/2', '<WP_DESKTOP>', SetupString, 'ReplaceIfExists')
  897.         If Rc<>1 Then
  898.             Do
  899.             Say "SysCreateObject failed"
  900.             Row=Row+1
  901.             Success="FALSE"
  902.             End
  903.         Else
  904.             Do
  905.             Say "SysCreateObject ok"
  906.             Row=Row+1
  907.             End
  908.         End
  909.                                         /* Rename WPS 2 PC/2's DLL to original name */
  910.     Command="@Ren WPS2PC2.dl_ WPS2PC2.dll"
  911.     Command
  912.     Command="@Ren WPS2PC2.hl_ WPS2PC2.hlp"
  913.     Command
  914.     End
  915.                                         /* On error wait for user acknowledgement */
  916. If Success="FALSE" Then
  917.     Do
  918.     Say
  919.     Parse Value SysCurPos() with Row Col
  920.     Say " Press the Enter key to continue..."
  921.     Col=Col+36
  922.     Call SysCurPos Row, Col
  923.     Pull Ignore
  924.     End
  925. Return Success
  926.  
  927. /*--------------------------------------------------------------------------------------*\
  928.  * Deletes the WPS Objects of PC/2 and/or WPS 2 PC/2.                                   *
  929.  * Req:                                                                                 *
  930.  *      DisplayLogo                                                                     *
  931.  * Returns:                                                                             *
  932.  *      Success ....... TRUE/FALSE                                                      *
  933. \*--------------------------------------------------------------------------------------*/
  934. DeleteWPSObjects: Arg SubPackageSelected
  935.                                         /* Now delete WPS Objects */
  936. Call DisplayLogo
  937. Say
  938. Say " Now deregistering WPS Objects..."
  939. Say
  940. Success="TRUE"
  941.                                         /* Delete PC/2 Object */
  942. If (SubPackageSelected="P" | SubPackageSelected="B") Then
  943.     Do
  944.     Parse Value SysCurPos() with Row Col
  945.     Call SysCurPos Row, Col
  946.     Say " Deinstalling WPS Object of "LRed"PC/2"LWhi
  947.     Col=Col+40
  948.     Call SysCurPos Row, Col
  949.     Rc=SysDestroyObject('<WP_PC2>');
  950.     if Rc<>1 Then
  951.         Do
  952.         Say "SysDestroyObject failed"
  953.         Row=Row+1
  954.         Success="FALSE"
  955.         End
  956.     Else
  957.         Do
  958.         Say "SysDestroyObject ok"
  959.         Row=Row+1
  960.         End
  961.     Say
  962.     End
  963.                                         /* Delete WPS 2 PC/2 Object */
  964. If (SubPackageSelected="W" | SubPackageSelected="B") Then
  965.     Do
  966.     Parse Value SysCurPos() with Row Col
  967.     Call SysCurPos Row, Col
  968.     Say " Deinstalling WPS Object of "LRed"WPS 2 PC/2"LWhi
  969.     Col=Col+40
  970.     Call SysCurPos Row, Col
  971.     Rc=SysDestroyObject('<WP_WPS2PC2>');
  972.     if Rc<>1 Then
  973.         Do
  974.         Say "SysDestroyObject failed"
  975.         Row=Row+1
  976.         Success="FALSE"
  977.         End
  978.     Else
  979.         Do
  980.         Say "SysDestroyObject ok"
  981.         Row=Row+1
  982.         End
  983.     Call SysCurPos Row, Col
  984.     Rc=SysDeregisterObjectClass('Wps2Pc2');
  985.     If Rc<>1 Then
  986.         Do
  987.         Say "SysDeregisterObjectClass failed"
  988.         Row=Row+1
  989.         Success="FALSE"
  990.         End
  991.     Else
  992.         Do
  993.         Say "SysDeregisterObjectClass ok"
  994.         Row=Row+1
  995.         End
  996.     End
  997.                                         /* On error wait for user acknowledgement */
  998. If Success="FALSE" Then
  999.     Do
  1000.     Say
  1001.     Say " Because automatic deletion faild, please try to delete the WPS Objects for"
  1002.     Say " "LRed"PC/2"LWhi" and "LRed"WPS 2 PC/2"LWhi" manually, by either selecting the Delete option from the"
  1003.     Say " WPS Object's context menu, or by dragging them into the Shredder."
  1004.     Say
  1005.     Parse Value SysCurPos() with Row Col
  1006.     Say " Press the Enter key to continue..."
  1007.     Col=Col+36
  1008.     Call SysCurPos Row, Col
  1009.     Pull Ignore
  1010.     End
  1011. Return Success
  1012.  
  1013. /*--------------------------------------------------------------------------------------*\
  1014.  * Deletes all files of PC/2 in the current directory and all WPS 2 PC/2 files in the   *
  1015.  * \OS2\ directory on the boot drive.                                                   *
  1016.  * Req:                                                                                 *
  1017.  *      DisplayLogo                                                                     *
  1018.  * Returns:                                                                             *
  1019.  *      Success ....... TRUE/FALSE                                                      *
  1020. \*--------------------------------------------------------------------------------------*/
  1021. PurgeFiles: Arg SourceDirectory, OS2Directory
  1022.                                         /* Now purge files */
  1023. Call DisplayLogo
  1024. Say
  1025. Say " Now deleting files (part 1 of 3)..."
  1026. Say
  1027. DeleteSuccess="TRUE"
  1028. If FileDelete('PC2.EXE', SourceDirectory)="FALSE" Then
  1029.     DeleteSuccess="FALSE"
  1030. If FileDelete('PC2HOOK.DLL', SourceDirectory)="FALSE" Then
  1031.     DeleteSuccess="FALSE"
  1032. If FileDelete('PC2BRES.DLL', SourceDirectory)="FALSE" Then
  1033.     DeleteSuccess="FALSE"
  1034. If FileDelete('PC2VRES.DLL', SourceDirectory)="FALSE" Then
  1035.     DeleteSuccess="FALSE"
  1036. If FileDelete('PC2SPOOL.DLL', SourceDirectory)="FALSE" Then
  1037.     DeleteSuccess="FALSE"
  1038. If FileDelete('PC2NET.DLL', SourceDirectory)="FALSE" Then
  1039.     DeleteSuccess="FALSE"
  1040. If FileDelete('PC2.HLP', SourceDirectory)="FALSE" Then
  1041.     DeleteSuccess="FALSE"
  1042. If FileDelete('PC2.DOC', SourceDirectory)="FALSE" Then
  1043.     DeleteSuccess="FALSE"
  1044. If FileDelete('HISTORY.DOC', SourceDirectory)="FALSE" Then
  1045.     DeleteSuccess="FALSE"
  1046. If FileDelete('TRAPINFO.DOC', SourceDirectory)="FALSE" Then
  1047.     DeleteSuccess="FALSE"
  1048. /*
  1049.  * If FileDelete('SURVEY.DOC', SourceDirectory)="FALSE" Then
  1050.  *     DeleteSuccess="FALSE"
  1051.  */
  1052. If FileDelete('INSTALL.CMD', SourceDirectory)="FALSE" Then
  1053.     DeleteSuccess="FALSE"
  1054. If DeleteSuccess="FALSE" Then
  1055.     Do
  1056.     Say
  1057.     Parse Value SysCurPos() with Row Col
  1058.     Say " Deletion failed - press the Enter key to continue..."
  1059.     Col=Col+53
  1060.     Call SysCurPos Row, Col
  1061.     Pull Ignore
  1062.     DeleteSuccess='TRUE'
  1063.     End
  1064. Else
  1065.     Call SysSleep 1
  1066. Call DisplayLogo
  1067. Say
  1068. Say " Now deleting files (part 2 of 3)..."
  1069. Say
  1070. If FileDelete('PC2-1.FAQ', SourceDirectory)="FALSE" Then
  1071.     DeleteSuccess="FALSE"
  1072. If FileDelete('PC2-2.FAQ', SourceDirectory)="FALSE" Then
  1073.     DeleteSuccess="FALSE"
  1074. If FileDelete('PC2-3.FAQ', SourceDirectory)="FALSE" Then
  1075.     DeleteSuccess="FALSE"
  1076. If FileDelete('SMALLFNT.CMD', SourceDirectory)="FALSE" Then
  1077.     DeleteSuccess="FALSE"
  1078. If FileDelete('SYSLEVEL.PC2', SourceDirectory)="FALSE" Then
  1079.     DeleteSuccess="FALSE"
  1080. If FileDelete('TUTORIAL.ZIP', SourceDirectory)="FALSE" Then
  1081.     DeleteSuccess="FALSE"
  1082. If FileDelete('SOURCE.ZIE', SourceDirectory)="FALSE" Then
  1083.     DeleteSuccess="FALSE"
  1084. If FileDelete('PROTECT.EXE', SourceDirectory)="FALSE" Then
  1085.     DeleteSuccess="FALSE"
  1086. If FileDelete('PC2.CFG', SourceDirectory)="FALSE" Then
  1087.     DeleteSuccess="FALSE"
  1088. If FileDelete('PC2.INI', SourceDirectory)="FALSE" Then
  1089.     DeleteSuccess="FALSE"
  1090. If FileDelete('PC2.ENV', SourceDirectory)="FALSE" Then
  1091.     DeleteSuccess="FALSE"
  1092. If FileDelete('WPS2PC2.DLL', SourceDirectory, OS2Directory||"DLL\")="FALSE" Then
  1093.     DeleteSuccess="FALSE"
  1094. If FileDelete('WPS2PC2.HLP', SourceDirectory, OS2Directory||"HELP\")="FALSE" Then
  1095.     DeleteSuccess="FALSE"
  1096. If DeleteSuccess="FALSE" Then
  1097.     Do
  1098.     Say
  1099.     Parse Value SysCurPos() with Row Col
  1100.     Say " Deletion failed - press the Enter key to continue..."
  1101.     Col=Col+53
  1102.     Call SysCurPos Row, Col
  1103.     Pull Ignore
  1104.     End
  1105. Else
  1106.     Call SysSleep 1
  1107. Call DisplayLogo
  1108. Say
  1109. Say " Now deleting files (part 3 of 3)..."
  1110. Say
  1111. If FileDelete('WPS2PC2.DLL', SourceDirectory, OS2Directory||"DLL\")="FALSE" Then
  1112.     DeleteSuccess="FALSE"
  1113. If FileDelete('WPS2PC2.HLP', SourceDirectory, OS2Directory||"HELP\")="FALSE" Then
  1114.     DeleteSuccess="FALSE"
  1115. If DeleteSuccess="FALSE" Then
  1116.     Do
  1117.     Say
  1118.     Parse Value SysCurPos() with Row Col
  1119.     Say " Deletion failed - press the Enter key to continue..."
  1120.     Col=Col+53
  1121.     Call SysCurPos Row, Col
  1122.     Pull Ignore
  1123.     End
  1124. Return DeleteSuccess
  1125.  
  1126. /*--------------------------------------------------------------------------------------*\
  1127.  * Display hints for user of PC/2 (about SmallFnt.cmd, STARTUPFOLDERSONLY and           *
  1128.  * RUNWORKPLACE statements, and the FAQ file).                                          *
  1129.  * Req:                                                                                 *
  1130.  *      DisplayLogo                                                                     *
  1131.  * Returns:                                                                             *
  1132.  *      Success ....... TRUE/FALSE                                                      *
  1133. \*--------------------------------------------------------------------------------------*/
  1134. DisplayHint: Arg SkipQuestionsFlag
  1135.                                         /* Now inform user about SMALLFNT.CMD */
  1136. If (SkipQuestionsFlag='N' | SkipQuestionsFlag="") Then 
  1137.     Do
  1138.     Call DisplayLogo
  1139.     Say
  1140.     Say " "LRed"PC/2"LWhi" also ships a small batch file called "LBro"SmallFnt.cmd"LWhi" which you may use to "
  1141.     Say " replace the default Proportional System font with a smaller 8 pts. Helv font. "
  1142.     Say " This batch files modifies your "LBro"OS2.INI"Lwhi" file so that after the next reboot "
  1143.     Say " most dialogs will be much smaller and more information fits on your screen. "
  1144.     Say " You may also use the Font Palette to drop the 8 pts. Helv font over the "
  1145.     Say " titlebar and menu of any application while you hold the ALT-key to make this "
  1146.     Say " font the default on titlebars and menus."
  1147.     Say
  1148.     Say " Also included is "LBro"PMColor.cmd"LWhi" which you can use to the the background"
  1149.     Say " color of PM. This batchfile is a sample to change settings in OS2*.INI when "
  1150.     Say " running PC/2 as the WPS replacement."
  1151.     Say
  1152.     Parse Value SysCurPos() with Row Col
  1153.     Say " Press the Enter key to continue..."
  1154.     Col=Col+36
  1155.     Call SysCurPos Row, Col
  1156.     Pull Ignore
  1157.                                         /* Now inform user about STARTUPFOLDERSONLY */
  1158.     Call DisplayLogo
  1159.     Say
  1160.                                         /* Search for CONFIG.SYS and the statement
  1161.                                            SET RESTARTOBJECTS=STARTUPFOLDERSONLY. Thanks
  1162.                                            to Stefan Hora for giving me a drive independent
  1163.                                            way to get data from actual CONFIG.SYS */
  1164.     FoundConfig=FALSE
  1165.     WorkPlace=strip(Value("RESTARTOBJECTS", , "OS2ENVIRONMENT"))
  1166.     if POS('STARTUPFOLDERSONLY', WorkPlace)\=0 Then Do
  1167.         FoundConfig=TRUE
  1168.     End
  1169.                                         /* Inform the user about CONFIG.SYS */
  1170.     If FoundConfig=TRUE Then Do
  1171.         Say " You have the statement "LBro"SET RESTARTOBJECTS=STARTUPFOLDERSONLY"LWhi" in your"
  1172.         Say " "LBro"CONFIG.SYS"LWhi". To enable OS/2 to start "LRed"PC/2"LWhi" during boot, you have to create"
  1173.         Say " a shadow of "LRed"PC/2"LWhi" and move it into your startup folder or add it to"
  1174.         Say " "LBro"STARTUP.CMD"LWhi"."
  1175.     End
  1176.     Else Do
  1177.         Say " You don't have the statement "LBro"SET RESTARTOBJECTS=STARTUPFOLDERSONLY"LWhi" in ypur"
  1178.         Say " "LBro"CONFIG.SYS"LWhi". OS/2 will start automatically "LRed"PC/2"LWhi" during next boot, if "LRed"PC/2"LWhi" is"
  1179.         Say " active before you Shutdown your System."
  1180.     End
  1181.     Say
  1182.                                         /* Now search for CONFIG.SYS and the statement
  1183.                                            SET RUNWORKPLACE=C:\OS2\PMSHELL.EXE. Again thanks
  1184.                                            to Stefan Hora for his drive independent approach */
  1185.     FoundConfig=FALSE
  1186.     WorkPlace=strip(Value("RUNWORKPLACE", , "OS2ENVIRONMENT"))
  1187.     if POS('PMSHELL.EXE', WorkPlace)\=0 Then Do
  1188.         FoundConfig=TRUE
  1189.     End
  1190.                                         /* Inform the user about CONFIG.SYS */
  1191.     If FoundConfig=TRUE Then Do
  1192.         Say " You have the statement "LBro"SET RUNWORKPLACE=d:\OS2\PMSHELL.EXE"LWhi" in your"
  1193.         Say " "LBro"CONFIG.SYS"LWhi". You may replace the "LBro"WPS"LWhi" by "LRed"PC/2"LWhi", please look into the online"
  1194.         Say " help panels of "LRed"PC/2"LWhi" for further information."
  1195.     End
  1196.     Else Do
  1197.         Say " It seems that you don't run the "LBro"WPS"LWhi" ("LBro"WorkPlace Shell"LWhi"). You may use "LRed"PC/2"LWhi" as"
  1198.         Say " a replacement for the WPS by adding to or modifying your "LBro"CONFIG.SYS"LWhi":"
  1199.         Say " "LGre"SET RUNWORKPLACE="DestinationDirectory"\PC2.EXE"LWhi
  1200.         Say " But be sure that "LRed"PC2HOOK.DLL"LWhi", "LRed"PC2SPOOL.DLL"LWhi", "LRed"PC2NET.DLL"LWhi" and "LRed"PC2.HLP"LWhi" are in"
  1201.         Say " the directory you started "LRed"PC/2"LWhi" from."
  1202.         Say " Please look into the online help panels of "LRed"PC/2"LWhi" for further information."
  1203.     End
  1204.     Say
  1205.     Parse Value SysCurPos() with Row Col
  1206.     Say " Press the Enter key to continue..."
  1207.     Col=Col+36
  1208.     Call SysCurPos Row, Col
  1209.     Pull Ignore
  1210.  
  1211.  
  1212.                                         /* Now inform user about PROTSHELL */
  1213.     Call DisplayLogo
  1214.     Say
  1215.                                         /* Now search for CONFIG.SYS and the statement
  1216.                                            PROTSHELL=C:\OS2\PMSHELL.EXE (we have to find
  1217.                                            the boot drive, which we will derive from the
  1218.                                            SYSTEM_INI environment setting, which of course
  1219.                                            could be changed to a different drive by the user
  1220.                                            too, but that's very unlikely and I don't know
  1221.                                            a better way) */
  1222.     FoundConfig=FALSE
  1223.     WorkPlace=strip(Value("SYSTEM_INI", , "OS2ENVIRONMENT"))
  1224.     ConfigSysFile=FileSpec("Drive", WorkPlace)||'\CONFIG.SYS'
  1225.     Call SysFileSearch 'PROTSHELL', ConfigSysFile, ConfigSysLines
  1226.     Do Line=1 to ConfigSysLines.0
  1227.         If (POS('PMSHELL.EXE', ConfigSysLines.Line)\=0 & POS('REM', ConfigSysLines.Line)=0) Then Do
  1228.             FoundConfig=TRUE
  1229.             Leave
  1230.         End
  1231.     End
  1232.                                         /* Inform the user about CONFIG.SYS */
  1233.     If FoundConfig=TRUE Then Do
  1234.         Say " You have the statement "LBro"PROTSHELL=d:\OS2\PMSHELL.EXE"LWhi" in your"
  1235.         Say " "LBro"CONFIG.SYS"LWhi". You may replace the "LBro"PROTSHELL"LWhi" by "LRed"PC/2"LWhi", please look into the"
  1236.         Say " online help panels of "LRed"PC/2"LWhi" for further information. This will work, though"
  1237.         Say " I don't recommend doing that."
  1238.     End
  1239.     Else Do
  1240.         Say " It seems that you don't run the "LBro"PMSHELL"LWhi" as the protected mode shell"
  1241.         Say " ("LBro"PROTSHELL"LWhi"). You may use "LRed"PC/2"LWhi" as the protected mode shell instead, by"
  1242.         Say " modifying in your "LBro"CONFIG.SYS"LWhi" (though I don't recommend that) to:"
  1243.         Say " "LGre"PROTSHELL="DestinationDirectory"\PC2.EXE"LWhi
  1244.         Say " But be sure that "LRed"PC2HOOK.DLL"LWhi", "LRed"PC2SPOOL.DLL"LWhi" and "LRed"PC2.HLP"LWhi" are in the directory"
  1245.         Say " you started "LRed"PC/2"LWhi" from."
  1246.         Say " Please look into the online help panels of "LRed"PC/2"LWhi" for further information."
  1247.     End
  1248.     Say
  1249.     Parse Value SysCurPos() with Row Col
  1250.     Say " Press the Enter key to continue..."
  1251.     Col=Col+36
  1252.     Call SysCurPos Row, Col
  1253.     Pull Ignore
  1254.  
  1255.                                         /* Now inform user about FAQ */
  1256.     Call DisplayLogo
  1257.     Say
  1258.                                         /* Inform the user about safety */
  1259.     Say " Don't forget to backup your configuration file regularily to avoid possible"
  1260.     Say " damages or data corruption."
  1261.     Say " If you drag a shadow of "LRed"PC/2"LWhi" into the startup folder and have not set"
  1262.     Say " "LBro"SET RESTARTOBJECTS=STARTUPFOLDERSONLY"LWhi" in your "LBro"CONFIG.SYS"LWhi" ensure that during"
  1263.     Say " loading of the "LBro"WPS"LWhi" "LRed"PC/2"LWhi" is only started by the startup folder to avoid an"
  1264.     Say " informational message."
  1265.     Say
  1266.     Say " If you find this utility useful and want to honor many months of work, you are"
  1267.     Say " welcome to send me a small donation. Please read the online documentation for"
  1268.     Say " further information! And, you're welcome to visit my homepage too!"
  1269.     Say
  1270.     Say " Please unzip and study the tutorial in TUTORIAL.ZIP, it's worth the effort and" 
  1271.     Say " can save you hours (even if you are already an experienced PC/2 user)!"
  1272.     Say
  1273.     Say "   Thank you!"
  1274.     Say
  1275.     Parse Value SysCurPos() with Row Col
  1276.     Say " Do you want to read the FAQ (Frequently Asked Questions) list? [Y/y"Non||Whi||BBlu"/N/n"LWhi"]: "LGre
  1277.                                         /* Ask the user if he wants to read the FAQ */
  1278.     Col=Col+75
  1279.     Call SysCurPos Row, Col
  1280.     Pull FAQFlag
  1281.     If FAQFlag="" Then
  1282.         FAQFlag="Y"
  1283. End
  1284. If FAQFlag='Y' Then Do
  1285.     Call DisplayLogo
  1286.     Command="@Type PC2-1.faq |more"
  1287.     Command
  1288.     Command="@Type PC2-2.faq |more"
  1289.     Command
  1290.     Command="@Type PC2-3.faq |more"
  1291.     Command
  1292.     End
  1293. Return "TRUE"
  1294.  
  1295. /*--------------------------------------------------------------------------------------*\
  1296.  * The CTRL+Break signal handler just ignores CTRL+BREAK.                               *
  1297.  * Req:                                                                                 *
  1298.  *      none                                                                            *
  1299.  * Returns:                                                                             *
  1300.  *      none                                                                            *
  1301. \*--------------------------------------------------------------------------------------*/
  1302. SignalHandler:
  1303. Return "TRUE"
  1304.  
  1305.