home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 March / Chip_2000-03_cd.bin / zkuste / SvetOS2 / WARPNOTE / WNOTE19.ZIP / install.cmd < prev    next >
OS/2 REXX Batch file  |  1999-12-20  |  6KB  |  211 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 WARPNOTE.INF 'Path'\*.*'"
  49.   INTERPRET "'COPY WNCOMM.EXE 'Path'\*.*'"
  50.   INTERPRET "'COPY WNHOOK.DLL 'Path'\*.*'"
  51.   INTERPRET "'COPY BIRTHDAY.* 'Path'\*.*'"
  52.  
  53.   Call SysFileTree Path"\WARPNOTE.DLL","dllfile","FO"
  54.  
  55.   if dllfile.0=1 then do
  56.     INTERPRET "'DEL 'Path'\WARPNOTE.DLL'"
  57.     say ""
  58.     say "You might need a new language module for the new version of WarpNote."
  59.     say ""
  60.   end
  61.  
  62.   say ""
  63.   say "Do you want to use the German language module ?"
  64.   say "Soll die deutsche Sprachunterstützung aktiviert werden ?"
  65.   say "(Y[es]/N[o])  (J[a]/N[ein])"
  66.   PULL answer
  67.  
  68.   if (answer="Y") | (answer="J") then signal German
  69.  
  70.   return 0
  71.  
  72. German:
  73.   INTERPRET "'ren 'Path'\WNOTEGER.DLL WARPNOTE.DLL'"
  74.  
  75. return 0
  76.  
  77. CreateObjects:
  78.   arg Path
  79.  
  80.   say ""
  81.   say "Do you want to create/update program objects for "AppName" ? (Y/N)"
  82.   pull answer
  83.  
  84.   if answer="Y" then do
  85.     say ""
  86.     say "Creating WPS objects..."
  87.  
  88.     /* Folder */
  89.     klasse='WPFolder'
  90.     titel='WarpNote'
  91.     ort='<WP_DESKTOP>'
  92.     param='OBJECTID=<WNOTE_ORDNER>;'
  93.     mode='f'
  94.     rc = SysCreateObject(klasse,titel,ort,param,mode)
  95.  
  96.     /* Das Programmobjekt anlegen */
  97.     klasse='WPProgram'
  98.     titel='WarpNote'
  99.     ort='<WNOTE_ORDNER>'
  100.     param='PROGTYPE=PM;EXENAME='Path'\WARPNOTE.EXE;STARTUPDIR='Path';'
  101.     mode='r'
  102.     rc = SysCreateObject(klasse,titel,ort,param,mode)
  103.  
  104.     /* Das Hilfeobjekt anlegen */
  105.     klasse='WPProgram'
  106.     titel='WarpNote Information'
  107.     ort='<WNOTE_ORDNER>'
  108.     param='PROGTYPE=PM;NOPRINT=YES;HELPPANEL=4083;EXENAME=VIEW.EXE;NOPRINT=YES;STARTUPDIR='Path';PARAMETERS='Path'\WARPNOTE.INF;'
  109.     mode='r'
  110.     rc = SysCreateObject(klasse,titel,ort,param,mode)
  111.  
  112.     /* Das Geburtstagsobjekt anlegen */
  113.     klasse='WPProgram'
  114.     titel='Birthday Reminder'
  115.     ort='<WNOTE_ORDNER>'
  116.     param='PROGTYPE=PM;NOPRINT=YES;HELPPANEL=4083;EXENAME='Path'\BIRTHDAY.CMD;NOPRINT=YES;STARTUPDIR='Path';'
  117.     mode='r'
  118.     rc = SysCreateObject(klasse,titel,ort,param,mode)
  119.  
  120.     klasse='WPProgram'
  121.     titel='Birthday List'
  122.     ort='<WNOTE_ORDNER>'
  123.     param='PROGTYPE=PM;NOPRINT=YES;HELPPANEL=4083;EXENAME=E.EXE;NOPRINT=YES;STARTUPDIR='Path';PARAMETERS='Path'\BIRTHDAY.TXT;'
  124.     mode='r'
  125.     rc = SysCreateObject(klasse,titel,ort,param,mode)
  126.  
  127.     /* Das Clipboard-Objekt anlegen */
  128.     klasse='WPProgram'
  129.     titel='Create Note from Clipboard'
  130.     ort='<WNOTE_ORDNER>'
  131.     param='PROGTYPE=PM;NOPRINT=YES;HELPPANEL=4083;EXENAME='Path'\WNCOMM.EXE;NOPRINT=YES;STARTUPDIR='Path';PARAMETERS=CLIPBOARD;'
  132.     mode='r'
  133.     rc = SysCreateObject(klasse,titel,ort,param,mode)
  134.  
  135.   end
  136.  
  137. return 0
  138.  
  139.  
  140. Install:
  141.  
  142. Question:
  143.   say ""
  144.   say "Where do you want to copy the files for "AppName" ?"
  145.   say "(e.g. "DefaultDir")  "
  146.   PARSE PULL path
  147.   IF path = "" THEN path=DefaultDir
  148.   say ""
  149.   say AppName" files will be copied to "path
  150.   say ""
  151.   say "Press <return> to continue, <E> to enter a new location or"
  152.   say "<C> to cancel."
  153.   pull answer
  154.  
  155.   if answer="C" then exit
  156.   if answer="E" then signal Question
  157.  
  158.   call CopyFiles path
  159.  
  160.   call CreateObjects path
  161.  
  162. return 0
  163.  
  164. Upgrade:
  165.   say ""
  166.   say "Please make a backup copy of the birthday list BIRTHDAY.TXT in"
  167.   say "the WarpNote directory if you have made changes."
  168.   say ""
  169.   say "Press RETURN to continue..."
  170.   pull answer
  171.  
  172.   dirs.0=0
  173.  
  174.   do until (LENGTH(drive)=1) & (dirs.0>0)
  175.     say ""
  176.     say "On what drive do you expect your installation ? (C,D,...)"
  177.     pull drive
  178.     if LENGTH(drive)=1 then do
  179.       call SysFileTree drive":\"ExeFile,"dirs","FSO"
  180.       if dirs.0=0 then say "The installation was not found on drive "drive"."
  181.     end
  182.   end
  183.  
  184.   do i=1 to dirs.0
  185.     dirs.i=FILESPEC("D",dirs.i) || FILESPEC("P",dirs.i)
  186.     l=LENGTH(dirs.i)
  187.     if l>3 then if SUBSTR(dirs.i,l,1)="\" then dirs.i=SUBSTR(dirs.i,1,l-1)
  188.     say ""
  189.     say "Do you want to upgrade "AppName" in "dirs.i" ? (Y/N)"
  190.     say ""
  191.     pull answer
  192.     if answer="Y" then do
  193.       call CopyFiles dirs.i
  194.       call CreateObjects dirs.i
  195.     end
  196.   end
  197. return 0
  198.  
  199. Err:
  200.   say ""
  201.   say "An error has occured. Possible causes are:"
  202.   say ""
  203.   say " - You have interrupted installation by pressing CTRL-BREAK."
  204.   say " - A file is missing in the package. Try to unpack the archive file again."
  205.   say " - A file cannot be replaced because it is in use. Make sure the program"
  206.   say "   you're about to install is not running currently."
  207.   say ""
  208.   say "Please try again later."
  209. exit
  210.  
  211.