home *** CD-ROM | disk | FTP | other *** search
/ Plex 4 / Plex4.mdf / insteng.cmd < prev    next >
OS/2 REXX Batch file  |  1994-11-10  |  9KB  |  254 lines

  1. /***INSTALL-Procedure for WKSHELL/2 (ENGLISH !!)***/
  2.  
  3. signal on halt name SignalHandler       /* Exception handler */
  4. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  5. call SysLoadFuncs
  6.  
  7. /* ******************************************* */
  8. SourceDrive=""
  9. SourceDir="\ENGLISH\"
  10. ExeDest="C:\WKSHELL\"
  11. DllDest="C:\WKSHELL\"
  12. File.0 = 5
  13. File.1="WKSHELLE.EXE"
  14. File.2="WKSHELLE.HLP"
  15. File.3="WKSHELLE.INF"
  16. File.4="WKSLISTE.CMD"
  17. File.5="UNZIP.EXE"
  18. Dll.0 = 3
  19. Dll.1= "dde4cc.dll"
  20. Dll.2= "dde4mbs.dll"
  21. Dll.3= "wks_mui.dll"
  22. global_again=1
  23.  
  24. /* ******************************************* */
  25. call InitColors
  26.  
  27. rc = SysFileTree("insteng.cmd", dummy, "F" ,"*****")  /* GET CD-ROM-Letter */
  28. if dummy.0 > 0 then do
  29.   SourceDrive=substr(dummy.1,38,2)
  30. end
  31. else do
  32.   say
  33.   say
  34.   say bred||"ERROR :"
  35.   say bred||"Please change first to your CD-drive and then start INSTENG.CMD"
  36.   say normal
  37.   exit
  38. end
  39.  
  40. do while global_again = 1
  41.    Men = MainMenu()
  42.    if Men="1" then do
  43.        call GotoXY 5,21
  44.        a = charout(,byellow||"Enter driveletter of your CD-ROM ?  ")
  45.        SourceDrive=Translate(SysGetKey('NOECHO'))
  46.        SourceDrive=SourceDrive || ":"
  47.    end
  48.    if Men="2" then do
  49.        call GotoXY 5,21
  50.        a = charout(,byellow||"New WK-Shell/2 directory   : ")
  51.        pull ExeDest
  52.        if right(ExeDest,1) \= "\" then
  53.           ExeDest=ExeDest||"\"
  54.    end
  55.    if Men="3" then do
  56.        call GotoXY 5,21
  57.        a = charout(,byellow||"New DLL directory            : ")
  58.        pull DllDest
  59.        if right(DllDest,1) \= "\" then
  60.           DllDest=DllDest||"\"
  61.    end
  62.    if Men="4" then do
  63.       say normal
  64.       Installed=1
  65.       Call Install
  66.    end
  67.    if Men="5" then do
  68.        call SysCls
  69.        global_again=0
  70.        say "The End...!"
  71.        if Installed=1 then do
  72.           say
  73.           say "You can run WK-Shell/2 from your harddisk by entering   :"
  74.           say bred||ExeDest||"WKSHELLE.EXE"||" "||SourceDrive
  75.           say bcyan||"The parameter <"||SourceDrive||"> is necessary to find the CD-ROM."
  76.        end
  77.        say normal
  78.        exit
  79.    end
  80. end
  81.  
  82.  
  83. /* ******************************************* */
  84. MainMenu:
  85. call SysCls
  86.     a = charout(,byellow||"┌──────────────────────────────────────────────────────────────────────────────┐")
  87.     a = charout(,"│                                 WK-Shell/2 INSTALL                           │")
  88.     a = charout(,"├──────────────────────────────────────────────────────────────────────────────┤")
  89.     a = charout(,"│                                                                              │")
  90.     a = charout(,"│                                                                              │")
  91.     a = charout(,"│                                                                              │")
  92.     a = charout(,"│                                                                              │")
  93.     a = charout(,"│                                                                              │")
  94.     a = charout(,"│                                                                              │")
  95.     a = charout(,"│                                                                              │")
  96.     a = charout(,"├──────────────────────────────────────────────────────────────────────────────┤")
  97.     a = charout(,"│                                                                              │")
  98.     a = charout(,"│                                                                              │")
  99.     a = charout(,"│                                                                              │")
  100.     a = charout(,"│                                                                              │")
  101.     a = charout(,"│                                                                              │")
  102.     a = charout(,"├──────────────────────────────────────────────────────────────────────────────┤")
  103.     a = charout(,"│                                                                              │")
  104.     a = charout(,"│                                                                              │")
  105.     a = charout(,"│                                                                              │")
  106.     a = charout(,"├──────────────────────────────────────────────────────────────────────────────┤")
  107.     a = charout(,"│                                                                              │")
  108.     a = charout(,"└────────────────────────────────────────────────────────────────────(C)'94 WOK┘")
  109.     call GotoXY 5,4
  110.     a = charout(,bcyan||"1) CD-ROM drive         : "||bred||SourceDrive)
  111.     call GotoXY 5,6
  112.     a = charout(,bcyan||"2) WK-Shell/2-directory : "||bred||ExeDest)
  113.     call GotoXY 5,8
  114.     a = charout(,bcyan||"3) DLL-directory        : "||bred||DllDest)
  115.     call GotoXY 5,12
  116.     a = charout(,bcyan||"4) INSTALL NOW !            ")
  117.     call GotoXY 5,14
  118.     a = charout(,bcyan||"5) EXIT! Out'a here...!     ")
  119.     call GotoXY 5,18
  120.     a = charout(,bcyan||"_ <--- Your choice ? ")
  121.     call GotoXY 5,18
  122.     again=1
  123.     do while again=1
  124.        MM_key=Translate(SysGetKey('NOECHO'))
  125.        if MM_key="1"|,
  126.          MM_key="2"|,
  127.          MM_key="3"|,
  128.          MM_key="4"|,
  129.          MM_key="5" then do
  130.            again=0
  131.            say MM_key
  132.        end
  133.     end
  134. return MM_key
  135.  
  136.  
  137. // ******************** INSTALL ***************************
  138. Install:
  139.   call SysCls
  140.   Error = 0
  141.   do i = 1 to File.0                        /* Copy EXE-Files */
  142.      Source=SourceDrive||SourceDir||File.i
  143.      if FileExists(Source) = 0 then do
  144.         say bred||"ERROR: Sourcefile not found: "||Source
  145.         'pause'
  146.         Error=1
  147.         Installed = 0
  148.         say normal
  149.      end
  150.      else 'xcopy 'Source ExeDest
  151.   end
  152.   do i = 1 to Dll.0                          /* Copy DLL-Files */
  153.      Source=SourceDrive||SourceDir||Dll.i
  154.      if FileExists(Source) = 0 then do
  155.         say bred||"ERROR: Sourcefile not found: "||Source
  156.         'pause'
  157.         Error=1
  158.         Installed = 0
  159.         say normal
  160.      end
  161.      else 'xcopy ' Source DllDest
  162.   end
  163.   'pause'
  164.   if Error = 0 then do                       /* Make Desktop-Object ? */
  165.     MM_input=""
  166.     do while MM_input\="Y" & MM_input\="N"   /* Security question */
  167.        say bcyan
  168.        say "Create a Desktop-Object for WK-Shell/2 (Y/N) ?"
  169.        pull MM_input
  170.     end /* do while */
  171.     if MM_input = "Y" then
  172.        call MakeObject
  173.   end
  174. return
  175.  
  176. /* *+++++++++++++++++++++++++++ */
  177. SignalHandler:
  178.   call SysCls
  179.   say bred||"Unterbrechung !"
  180.   say normal
  181.   exit
  182.  
  183.  
  184. /* ******************************** */
  185. FileExists: procedure
  186.    Maske = arg(1)
  187.    rc = SysFileTree(Maske, dummy, "FO" ,"*****")
  188.    if dummy.0 > 0 then
  189.      return 1
  190.    else
  191.      return 0
  192.  
  193. /* ******************************+  */
  194. MakeObject:
  195.   SetupString="TITLE=WK-Shell/2 (E);OBJECTID=<WKSHELL2E>;ASSOCFILTER=*.IDX;EXENAME="||ExeDest||"WKSHELLE.EXE;PARAMETERS="||SourceDrive
  196.   rc=SysCreateObject("WPProgram",,
  197.      ExeDest||"WKSHELLE.EXE",,
  198.      "<WP_DESKTOP>",,
  199.      SetupString)
  200.    if rc=0 then do
  201.      say "WPS-Object could NOT be created."
  202.      pause
  203.    end
  204.    else do
  205.      say "WPS-Objekt successfully created."
  206.    end
  207. return
  208.  
  209.  
  210.  
  211.  
  212.  
  213. /* ***********************************************
  214.    * Set Color Strings for AnsiColor
  215.    *********************************************** */
  216. InitColors:
  217.   esc     = '1B'x          /* define ESCape character */
  218.   red     = esc||"[31m"    /* ANSI.SYS-control for red foreground */
  219.   yellow  = esc||"[33m"    /* ANSI.SYS-control for yellow foreground */
  220.   cyan      = esc||"[36m"  /* ANSI.SYS-control for cyan foreground */
  221.   normal  = esc||"[0m"     /* ANSI.SYS-control for resetting attributes to normal */
  222.   bright  = esc||"[1m"     /* ANSI.SYS-control for bright foreground colors */
  223.   bred    = bright || red
  224.   byellow = bright || yellow
  225.   bcyan   = bright || cyan
  226.   upline  = esc||'[1A'     /* Cursor one line up */
  227.  
  228. RETURN
  229.  
  230. /* ************************************************
  231.    * WhereX()
  232.    ************************************************ */
  233. WhereX: procedure
  234.     parse value SysCurPos() with W_z W_s
  235. return W_s
  236.  
  237. /* ************************************************
  238.    * WhereY()
  239.    ************************************************ */
  240. WhereY: procedure
  241.     parse value SysCurPos() with W_z W_s
  242. return W_z
  243.  
  244. /* ************************************************
  245.    * GotoXY(x,y)
  246.    ************************************************ */
  247. GotoXY: procedure
  248.     G_s=arg(1)
  249.     G_z=arg(2)
  250.     G_dummy=SysCurPos(G_z, G_S)
  251. return
  252.  
  253.  
  254.