home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / dragen1.zip / setup.cmd < prev    next >
OS/2 REXX Batch file  |  2000-03-26  |  7KB  |  181 lines

  1. /* Obtain user's preferences and create Dragen Objects */
  2.      Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  3.      Call SysLoadFuncs
  4.      parse source operatingsystem commandtype sourcefilename
  5.      fpos=lastpos("\",sourcefilename)
  6.      if fpos \= 0 then
  7.      fpath=left(sourcefilename,fpos)
  8.      say fpath
  9.      echo off
  10.      cls
  11.      say "Dragen FTP Setup Script"
  12. downagain:
  13.      say ""
  14.      say "Please type full path for your preferred download directory (i.e. f:\download):"
  15.      say "(To use default of " fpath"download  -  Press Enter)"
  16.      pull download
  17.      if download = '' then download = 'download'
  18.      if right(download,1) = '\' then download = left(download,length(download) - 1)
  19.      call sysfiletree download,'drag','D'
  20.      if drag.0 \= 1 then
  21.         do
  22.            say download 'does not exist.  Setup will attempt to create it.'
  23.            if lastpos(':',download) = 0  & lastpos('\',download) = 0 then download = fpath||download
  24.            rc = SysMkDir(download)
  25.            if rc = 0 then
  26.               say download 'successfully created'
  27.             else
  28.                do
  29.                   say download 'could not be created.'
  30.                   say 'Press Enter to try  again or "Q" to skip this entry.'
  31.                   say 'If you skip this entry you must manually edit' fpath'DPATH'
  32.                   say 'and enter the fully qualified download directory name'
  33.                   say 'as the first line or Dragen will not function.'
  34.                   parse upper pull oops; if oops = '' then signal downagain
  35.                   download = ' '
  36.                end
  37.         end
  38.       else
  39.         do
  40.            parse var drag.1 . . . . download
  41.            download = strip(download)
  42.         end
  43.      say ""
  44.      oldhost = SysTempFileName(fpath'hosts.???')
  45.      say 'Would you like to place the default download directory'
  46.      say 'into each Host entry? (y/N)'
  47.      say '(The existing HOSTS.TXT file will be saved as' oldhost')'
  48.      parse upper pull oops
  49.      if oops = 'Y' then
  50.       do
  51.          call stream oldhost, 'c', 'open write'; call stream oldhost, 'c', 'close'
  52.          'copy' fpath'hosts.txt' oldhost
  53.          newhost = SysTempFileName(fpath'hosts.???')
  54.          myline = 0
  55.          do while lines(fpath'hosts.txt')
  56.             ism = linein(fpath'hosts.txt')
  57.             myline = myline + 1
  58.             if myline = 6 then
  59.                call lineout newhost, download
  60.              else
  61.                call lineout newhost, ism
  62.             if myline = 8 then myline = 0
  63.          end
  64.          oc = stream(fpath'hosts.txt','c','close'); nc = stream(newhost,'c','close')
  65.          if oc = 'READY:' & nc = 'READY:' then
  66.            do
  67.             call sysfiledelete fpath'hosts.txt'
  68.             'rename' newhost 'hosts.txt'
  69.            end
  70.           else
  71.             do
  72.             say 'Setup encountered an unresolved error in creating a new HOSTS file.'
  73.             say 'HOSTS.TXT will not be replaced.'
  74.             call SysFileDelete newhost; call SysFileDelete oldhost
  75.             end
  76.       end
  77.  
  78. edagain:
  79.      say ""
  80.      say "Please type full path and name for your preferred text editor:"
  81.      say "(To use default, C:\OS2\E.EXE, press Enter.)"
  82.      parse upper pull editor
  83.      if editor = '' then editor = 'C:\OS2\E.EXE'
  84.      call sysfiletree editor,'drag','F'
  85.      if drag.0 \= 1 then
  86.         do
  87.            say editor 'was not found.'
  88.            say 'Press Enter to try again or enter a "Q" to accept "E.EXE" using your'
  89.            say 'existing PATH environment.'
  90.            parse upper pull oops; if oops = '' then signal edagain
  91.            say '"E.EXE" has been inserted into' fpath'DPATH'
  92.            say 'If this is not satisfactory, you must manually correct'
  93.            say 'the entry in the second line of ' fpath'DPATH'
  94.            editor = 'E.EXE'
  95.         end
  96.      say ""
  97. playagain:
  98.      say ""
  99.      say "Which program do you want to use to play your mp3 files?"
  100.      say "Type mplay1 for high quality, mplay2 for medium quality, or"
  101.      say "mplay3 for low quality."
  102.      say "If you have your own player, enter its full path and name:"
  103.      say "(To use default, MPLAY2  -  press Enter.)"
  104.      parse upper pull mplay
  105.      if mplay = '' then mplay = 'MPLAY2'
  106.      call sysfiletree mplay,'drag','F'
  107.      if drag.0 \= 1 & mplay \= 'MPLAY1' & mplay \= 'MPLAY2' & mplay \= 'MPLAY3' then
  108.         do
  109.            say mplay 'was not found.'
  110.            say 'Press Enter to try again or "Q" to accept ' fpath'MPLAY2'
  111.            parse upper pull oops; if oops = '' then signal playagain
  112.            say 'Setup will assume "mplay2" and use existing PATH environment.'
  113.            say 'If this is not satisfactory, you must manually put the'
  114.            say ' correct entry in the third line of ' fpath'DPATH'
  115.            mplay = 'mplay2'
  116.         end
  117.      say ""
  118.      say "Please enter the length of time in seconds that you want Dragen"
  119.      say "to wait before it terminates a logon attempt:"
  120.      say "(To use default, 45 seconds, press Enter.)"
  121.      pull killdelay
  122.      if killdelay = '' then killdelay = 45
  123.      if \datatype(killdelay,'n') then
  124.         do
  125.            say killdelay 'is not numeric.  It will be set to 45 seconds.'
  126.            killdelay = 45
  127.         end
  128.      if killdelay > 300 then say "Personally, I wouldn't use a server *THAT* bloody slow!"
  129.      say ""
  130.      say "Please enter your proxy hostname, url, or ip address if you"
  131.      say "are behind a firewall."
  132.      say "If you are not behind a firewall, press Enter:"
  133.      proxyport = ''
  134.      pull proxy
  135.      if proxy \= '' then
  136.       do
  137.         say "Please enter your proxy port number if it is not 21, otherwise press Enter:"
  138.         pull proxyport
  139.         if proxyport = '' then proxyport = '21'
  140.       end /* do */
  141.      say ""
  142.      say ""
  143.      getstr="del dpath"
  144.      getstr
  145.      rc=lineout(dpath,download)
  146.      rc=lineout(dpath,editor)
  147.      rc=lineout(dpath,mplay)
  148.      rc=lineout(dpath,killdelay)
  149.      rc=lineout(dpath,proxy)
  150.      rc=lineout(dpath,proxyport)
  151.      rc=lineout(dpath)
  152.      say ""
  153.      if rc = 0 then
  154.      say "setup file created"
  155.      else
  156.      say "error in creating setup file"
  157.      say ""
  158.      iconname="dragen.ico"
  159.      iconid="Dragen FTP"
  160.      Folder = '<WP_DESKTOP>'
  161.      Type = 'WPProgram'
  162.      Title = "dragen.exe"
  163.      pathfile=fpath||"dragen.exe"
  164.      path=left(sourcefilename,fpos-1)
  165.      iconsource=fpath"\"iconname
  166.      Parms = "MINIMIZED=yes;ICONFILE="iconsource";MINWIN=SYMBOL;PROGTYPE=WP;EXENAME="pathfile";STARTUPDIR="fpath";OBJECTID=<"title">;NOPRINT=YES;Title="iconid";"
  167.      Result = SysCreateObject( Type, Title, Folder, Parms, 'ReplaceIfExists' )
  168.      say "Placing Dragen program icon on the desktop."
  169.      iconname="dragdrp.ico"
  170.      iconid="Dragen DropZone"
  171.      Folder = '<WP_DESKTOP>'
  172.      Type = 'WPProgram'
  173.      Title = "dragstrt.cmd"
  174.      pathfile=fpath||"dragstrt.cmd"
  175.      path=left(sourcefilename,fpos-1)
  176.      iconsource=fpath"\"iconname
  177.      Parms = "MINIMIZED=yes;ICONFILE="iconsource";MINWIN=SYMBOL;PROGTYPE=WP;EXENAME="pathfile";STARTUPDIR="fpath";OBJECTID=<"title">;NOPRINT=YES;Title="iconid";"
  178.      Result = SysCreateObject( Type, Title, Folder, Parms, 'ReplaceIfExists' )
  179.      say "Placing Dragen DropZone icon on the desktop."
  180.      say "Done."
  181.