/* INSTALL.cmd - (c) Copyright 1996, Rhintek, Incorporated */

   root = 'BEMDEMO1'

   '@echo off'

   /* get the system functions involved so that we can use them */
   call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
   call SysLoadFuncs

   /* open the readme file in e */
   'start "BEM Readme" /F e readme.1st'
   say 'Installing...'

   /* get the current directory */
   thepath = SysSearchPath( PATH, "BEMbook.ico" )
   lastslash = lastpos( '\', thepath)
   thepath = substr( thepath, 1, lastslash )

   /* make the folder for the BEM directory on the desktop */
   icons = 'ICONFILE=' || thepath || 'BEMFLDR.ICO;ICONNFILE=1,' || thepath || 'BEMFLDRo.ICO'
   background = 'BACKGROUND=' || thepath || 'tile2blu.bmp,T,1,I;'
   setupstring = 'OBJECTID=<'||root||'FLDR>;' || background || icons
   rc = SysCreateObject( WPFolder, "BEM Demo", "<WP_DESKTOP>", setupstring )
   if rc = 0
      then say "error in creating folder on the desktop"

   /* add the shadow of the general readme (so its first in the folder) */
   setupstring = 'SHADOWID=' || thepath || 'readme.1st;'
   rc = SysCreateObject( WPShadow, " ", "<"||root||"FLDR>", setupstring )
   if rc = 0
      then say "error in creating shadow of General Readme"

   /* make the program object for the config.exe */
   execstring = 'EXENAME=' || thepath || 'config.exe;'
   startstring = 'STARTUPDIR=' || thepath
   icons = 'ICONFILE=' || thepath || 'bconfig.ICO;'
   setupstring = 'OBJECTID=<'||root||'CFG>;' || icons || execstring || startstring
   rc = SysCreateObject( WPProgram, "BEM Config", "<"||root||"FLDR>", setupstring )
   if rc = 0
      then say "error in creating Config object"

   /* make the program object for single-player BEM */
   execstring = 'EXENAME=' || thepath || 'oseer.exe;'
   paramstring = 'PARAMETERS=pld;'
   startstring = 'STARTUPDIR=' || thepath
   icons = 'ICONFILE=' || thepath || 'single.ICO;'
   setupstring = 'OBJECTID=<'||root||'SNGL>;' || icons || execstring || paramstring || startstring
   rc = SysCreateObject( WPProgram, "Single-Player", "<"||root||"FLDR>", setupstring )
   if rc = 0
      then say "error in creating Single-Player"

   /* make a program object that points to the inf */
   execstring = 'EXENAME=view.exe;'
   paramstring = 'PARAMETERS=bemnet.inf;'
   startstring = 'STARTUPDIR=' || thepath
   icons = 'ICONFILE=' || thepath || 'bembook.ICO;'
   setupstring = 'OBJECTID=<'||root||'HELP>;' || icons || execstring || paramstring || startstring
   rc = SysCreateObject( WPProgram, "BEM Help", "<"||root||"FLDR>", setupstring )
   if rc = 0
      then say "error in creating BEM Book"

   /* make the folder for the Client in the BEM folder */
   icons = 'ICONFILE=' || thepath || 'BEMFLDR.ICO;ICONNFILE=1,' || thepath || 'BEMFLDRo.ICO'
   background = 'BACKGROUND=' || thepath || 'tile2grn.bmp,T,1,I;'
   setupstring = 'OBJECTID=<'||root||'CLNT>;' || background || icons
   rc = SysCreateObject( WPFolder, "Client", "<"||root||"FLDR>", setupstring )
   if rc = 0
      then say "error in creating client folder in BEM demo "

   /* add the readme first so that is is the object to the left */
   setupstring = 'SHADOWID=' || thepath || 'readme.clt;'
   rc = SysCreateObject( WPShadow, " ", "<"||root||"CLNT>", setupstring )
   if rc = 0
      then say "error in creating shadow of Client Readme"

   /* add the Direct-Connect client */
   execstring = 'EXENAME=' || thepath || 'rhino.exe;'
   paramstring = 'PARAMETERS=clntdir.rcf "/T=Direct-Connect Client";'
   startstring = 'STARTUPDIR=' || thepath
   icons = 'ICONFILE=' || thepath || 'single.ICO;'
   setupstring = 'OBJECTID=<'||root||'CDIR>;' || icons || execstring || paramstring || startstring
   rc = SysCreateObject( WPProgram, "Direct-Connect", "<"||root||"CLNT>", setupstring )
   if rc = 0
      then say "error in creating Client Direct-Connect"

   /* add the COM client */
   execstring = 'EXENAME=' || thepath || 'rhino.exe;'
   paramstring = 'PARAMETERS=clntcom.rcf "/T=COM Client";'
   startstring = 'STARTUPDIR=' || thepath
   icons = 'ICONFILE=' || thepath || 'single.ICO;'
   setupstring = 'OBJECTID=<'||root||'CCOM>;' || icons || execstring || paramstring || startstring
   rc = SysCreateObject( WPProgram, "Modem", "<"||root||"CLNT>", setupstring )
   if rc = 0
      then say "error in creating Client COM"

   /* add the Client Internet/TCPIP connection object */
   execstring = 'EXENAME=' || thepath || 'rhino.exe;'
   paramstring = 'PARAMETERS=client.rcf "/T=Internet/TCPIP";'
   startstring = 'STARTUPDIR=' || thepath
   icons = 'ICONFILE=' || thepath || 'single.ICO;'
   setupstring = 'OBJECTID=<'||root||'CTCPIP>;' || icons || execstring || paramstring || startstring
   rc = SysCreateObject( WPProgram, "Internet/TCPIP", "<"||root||"CLNT>", setupstring )
   if rc = 0
      then say "error in creating Internet/TCPIP Client"

   /* make the folder for Server in the BEM demo folder */
   icons = 'ICONFILE=' || thepath || 'BEMFLDR.ICO;ICONNFILE=1,' || thepath || 'BEMFLDRo.ICO'
   background = 'BACKGROUND=' || thepath || 'tile2red.bmp,T,1,I;'
   setupstring = 'OBJECTID=<'||root||'SRVR>;' || background || icons
   rc = SysCreateObject( WPFolder, "Server", "<"||root||"FLDR>", setupstring )
   if rc = 0
      then say "error in creating server folder in BEM demo"

   /* add the readme first so that it is the leftmost item */
   setupstring = 'SHADOWID=' || thepath || 'readme.svr;'
   rc = SysCreateObject( WPShadow, " ", "<"||root||"SRVR>", setupstring )
   if rc = 0
      then say "error in creating shadow of Server Readme"

   /* add the overseer to the Server Folder (since it has to run first, put it here) */
   execstring = 'EXENAME=' || thepath || 'oseer.exe;'
   startstring = 'STARTUPDIR=' || thepath
   icons = 'ICONFILE=' || thepath || 'overseer.ICO;'
   setupstring = 'OBJECTID=<'||root||'OSEER>;' || icons || execstring || startstring
   rc = SysCreateObject( WPProgram, "Overseer", "<"||root||"SRVR>", setupstring )
   if rc = 0
      then say "error in creating overseer"

   /* make the program object for local player BEM */
   execstring = 'EXENAME=' || thepath || 'pld.exe;'
   paramstring = 'PARAMETERS=/c=oseer;'
   startstring = 'STARTUPDIR=' || thepath
   icons = 'ICONFILE=' || thepath || 'single.ICO;'
   setupstring = 'OBJECTID=<'||root||'LCPL>;' || icons || execstring || startstring
   rc = SysCreateObject( WPProgram, "Local-Player", "<"||root||"SRVR>", setupstring )
   if rc = 0
      then say "error in creating Local-Player"

   /* add the Direct-Connect server */
   execstring = 'EXENAME=' || thepath || 'rhino.exe;'
   paramstring = 'PARAMETERS=srvrdir.rcf "/T=Direct-Connect Server";'
   startstring = 'STARTUPDIR=' || thepath
   icons = 'ICONFILE=' || thepath || 'bserver.ICO;'
   setupstring = 'OBJECTID=<'||root||'SDIR>;' || icons || execstring || paramstring || startstring
   rc = SysCreateObject( WPProgram, "Direct-Connect", "<"||root||"SRVR>", setupstring )
   if rc = 0
      then say "error in creating Server Direct-Connect"

   /* put the COM server in -- we expect this to be the most common connection */
   execstring = 'EXENAME=' || thepath || 'rhino.exe;'
   paramstring = 'PARAMETERS=srvrcom.rcf "/T=COM Server";'
   icons = 'ICONFILE=' || thepath || 'bserver.ICO;'
   setupstring = 'OBJECTID=<'||root||'SCOM>;' || icons || execstring || paramstring || startstring
   rc = SysCreateObject( WPProgram, "Modem", "<"||root||"SRVR>", setupstring )
   if rc = 0
      then say "error in creating Server COM"

   /* put the multisession server in */
   execstring = 'EXENAME=' || thepath || 'rhino.exe;'
   paramstring = 'PARAMETERS=server.rcf "/T=Multisession Server";'
   icons = 'ICONFILE=' || thepath || 'bserver.ICO;'
   setupstring = 'OBJECTID=<'||root||'SMULTI>;' || icons || execstring || paramstring || startstring
   rc = SysCreateObject( WPProgram, "MultiSession", "<"||root||"SRVR>", setupstring )
   if rc = 0
      then say "error in creating MultiSession Server"

   say 'Install Complete, read the readme.1st file and have fun, Soldier!'

endit:


/* pause
 'kill e' */
