home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: InfoMgt / InfoMgt.zip / wnote192.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  2000-05-03  |  6KB  |  225 lines

  1. /*****************************************************************************/
  2. /* INSTALL.CMD Installation script using REXX, allowing upgrade installation */
  3. /* (c)1997 Uwe Schlenther Software, Bebelstraße 30, 70193 Stuttgart, Germany */
  4. /*****************************************************************************/
  5.  
  6. SIGNAL ON ERROR NAME Err
  7.  
  8. Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  9. Call SysLoadFuncs;
  10.  
  11. AppName="WarpNote"
  12. ExeFile="WARPNOTE.EXE"
  13. DefaultDir="C:\WarpNote"
  14.  
  15. Call SysFileTree ExeFile,"dirs","FO"
  16.  
  17. if dirs.0<>1 then do
  18.   say ""
  19.   say "It seems you haven't unpacked the archive file."
  20.   say "Please do so and try again."
  21.   exit
  22. end
  23.  
  24. say ""
  25. say "You're about to install "AppName". Welcome !"
  26. say ""
  27. say "Do you want to upgrade a previous installation of "AppName" ? (Y/N)"
  28. pull answer
  29.  
  30. if answer="Y" then do
  31.   call Upgrade
  32. end
  33. else do
  34.   call Install
  35. end
  36.  
  37. exit
  38.  
  39.  
  40.  
  41. CopyFiles:
  42.   arg Path
  43.  
  44.   call SysMkDir Path
  45.  
  46.   INTERPRET "'COPY WARPNOTE.EX? 'Path'\*.*'"
  47.   INTERPRET "'COPY WNOTEGER.DLL 'Path'\*.*'"
  48.   INTERPRET "'COPY WNOTEFR.DLL 'Path'\*.*'"
  49.   INTERPRET "'COPY WARPNOTE.INF 'Path'\*.*'"
  50.   INTERPRET "'COPY WNCOMM.EXE 'Path'\*.*'"
  51.   INTERPRET "'COPY WNHOOK.DLL 'Path'\*.*'"
  52.   INTERPRET "'COPY BIRTHDAY.* 'Path'\*.*'"
  53.  
  54.   Call SysFileTree Path"\WARPNOTE.DLL","dllfile","FO"
  55.  
  56.   if dllfile.0=1 then do
  57.     INTERPRET "'DEL 'Path'\WARPNOTE.DLL'"
  58.     say ""
  59.     say "You might need a new language module for the new version of WarpNote."
  60.     say ""
  61.   end
  62.  
  63.   say ""
  64.   say "Do you want to use the German language module ?"
  65.   say "Soll die deutsche Sprachunterstützung aktiviert werden ?"
  66.   say "(Y[es]/N[o])  (J[a]/N[ein])"
  67.   PULL answer
  68.  
  69.   if (answer="Y") | (answer="J") then signal German
  70.  
  71.   say ""
  72.   say "Do you want to use the French language module ?"
  73.   say "Voulez-vous utiliser le module en français ?"
  74.   say "(Y[es]/N[o])  (O[ui]/N[on])"
  75.   PULL answer
  76.  
  77.   if (answer="Y") | (answer="O") then signal French
  78.  
  79.   return 0
  80.  
  81. German:
  82.   INTERPRET "'ren 'Path'\WNOTEGER.DLL WARPNOTE.DLL'"
  83.  
  84. return 0
  85.  
  86. French:
  87.   INTERPRET "'ren 'Path'\WNOTEFR.DLL WARPNOTE.DLL'"
  88.  
  89. return 0
  90.  
  91. CreateObjects:
  92.   arg Path
  93.  
  94.   say ""
  95.   say "Do you want to create/update program objects for "AppName" ? (Y/N)"
  96.   pull answer
  97.  
  98.   if answer="Y" then do
  99.     say ""
  100.     say "Creating WPS objects..."
  101.  
  102.     /* Folder */
  103.     klasse='WPFolder'
  104.     titel='WarpNote'
  105.     ort='<WP_DESKTOP>'
  106.     param='OBJECTID=<WNOTE_ORDNER>;'
  107.     mode='f'
  108.     rc = SysCreateObject(klasse,titel,ort,param,mode)
  109.  
  110.     /* Das Programmobjekt anlegen */
  111.     klasse='WPProgram'
  112.     titel='WarpNote'
  113.     ort='<WNOTE_ORDNER>'
  114.     param='PROGTYPE=PM;EXENAME='Path'\WARPNOTE.EXE;STARTUPDIR='Path';'
  115.     mode='r'
  116.     rc = SysCreateObject(klasse,titel,ort,param,mode)
  117.  
  118.     /* Das Hilfeobjekt anlegen */
  119.     klasse='WPProgram'
  120.     titel='WarpNote Information'
  121.     ort='<WNOTE_ORDNER>'
  122.     param='PROGTYPE=PM;NOPRINT=YES;HELPPANEL=4083;EXENAME=VIEW.EXE;NOPRINT=YES;STARTUPDIR='Path';PARAMETERS='Path'\WARPNOTE.INF;'
  123.     mode='r'
  124.     rc = SysCreateObject(klasse,titel,ort,param,mode)
  125.  
  126.     /* Das Geburtstagsobjekt anlegen */
  127.     klasse='WPProgram'
  128.     titel='Birthday Reminder'
  129.     ort='<WNOTE_ORDNER>'
  130.     param='PROGTYPE=PM;NOPRINT=YES;HELPPANEL=4083;EXENAME='Path'\BIRTHDAY.CMD;NOPRINT=YES;STARTUPDIR='Path';'
  131.     mode='r'
  132.     rc = SysCreateObject(klasse,titel,ort,param,mode)
  133.  
  134.     klasse='WPProgram'
  135.     titel='Birthday List'
  136.     ort='<WNOTE_ORDNER>'
  137.     param='PROGTYPE=PM;NOPRINT=YES;HELPPANEL=4083;EXENAME=E.EXE;NOPRINT=YES;STARTUPDIR='Path';PARAMETERS='Path'\BIRTHDAY.TXT;'
  138.     mode='r'
  139.     rc = SysCreateObject(klasse,titel,ort,param,mode)
  140.  
  141.     /* Das Clipboard-Objekt anlegen */
  142.     klasse='WPProgram'
  143.     titel='Create Note from Clipboard'
  144.     ort='<WNOTE_ORDNER>'
  145.     param='PROGTYPE=PM;NOPRINT=YES;HELPPANEL=4083;EXENAME='Path'\WNCOMM.EXE;NOPRINT=YES;STARTUPDIR='Path';PARAMETERS=CLIPBOARD;'
  146.     mode='r'
  147.     rc = SysCreateObject(klasse,titel,ort,param,mode)
  148.  
  149.   end
  150.  
  151. return 0
  152.  
  153.  
  154. Install:
  155.  
  156. Question:
  157.   say ""
  158.   say "Where do you want to copy the files for "AppName" ?"
  159.   say "(e.g. "DefaultDir")  "
  160.   PARSE PULL path
  161.   IF path = "" THEN path=DefaultDir
  162.   say ""
  163.   say AppName" files will be copied to "path
  164.   say ""
  165.   say "Press <return> to continue, <E> to enter a new location or"
  166.   say "<C> to cancel."
  167.   pull answer
  168.  
  169.   if answer="C" then exit
  170.   if answer="E" then signal Question
  171.  
  172.   call CopyFiles path
  173.  
  174.   call CreateObjects path
  175.  
  176. return 0
  177.  
  178. Upgrade:
  179.   say ""
  180.   say "Please make a backup copy of the birthday list BIRTHDAY.TXT in"
  181.   say "the WarpNote directory if you have made changes."
  182.   say ""
  183.   say "Press RETURN to continue..."
  184.   pull answer
  185.  
  186.   dirs.0=0
  187.  
  188.   do until (LENGTH(drive)=1) & (dirs.0>0)
  189.     say ""
  190.     say "On what drive do you expect your installation ? (C,D,...)"
  191.     pull drive
  192.     if LENGTH(drive)=1 then do
  193.       call SysFileTree drive":\"ExeFile,"dirs","FSO"
  194.       if dirs.0=0 then say "The installation was not found on drive "drive"."
  195.     end
  196.   end
  197.  
  198.   do i=1 to dirs.0
  199.     dirs.i=FILESPEC("D",dirs.i) || FILESPEC("P",dirs.i)
  200.     l=LENGTH(dirs.i)
  201.     if l>3 then if SUBSTR(dirs.i,l,1)="\" then dirs.i=SUBSTR(dirs.i,1,l-1)
  202.     say ""
  203.     say "Do you want to upgrade "AppName" in "dirs.i" ? (Y/N)"
  204.     say ""
  205.     pull answer
  206.     if answer="Y" then do
  207.       call CopyFiles dirs.i
  208.       call CreateObjects dirs.i
  209.     end
  210.   end
  211. return 0
  212.  
  213. Err:
  214.   say ""
  215.   say "An error has occured. Possible causes are:"
  216.   say ""
  217.   say " - You have interrupted installation by pressing CTRL-BREAK."
  218.   say " - A file is missing in the package. Try to unpack the archive file again."
  219.   say " - A file cannot be replaced because it is in use. Make sure the program"
  220.   say "   you're about to install is not running currently."
  221.   say ""
  222.   say "Please try again later."
  223. exit
  224.  
  225.