home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0210 - 0219 / ibm0210-0219 / ibm0213.tar / ibm0213 / LS4APWAB.ZIP / LS40A.A10 / IBMLSA / IBM400P1 / VENDPROG.ZIP / NETPROGO.CMD < prev    next >
Encoding:
Text File  |  1994-06-10  |  11.5 KB  |  248 lines

  1. /* -------------------------------------------------------------- */
  2. /* NetProg Sample program Installation procedure.                 */
  3. /*    Copyright (c) 1993 IBM Corp.                                */
  4. /*    IBM Internal Use Only                                       */
  5. /*                                                                */
  6. /* WARNING:  if you use these samples as is, they will take a long*/
  7. /*  time to create because the network will search for an alias   */
  8. /*  name that doesn't exist. So, fill in your own names to improve*/
  9. /*  performance.    (and so they will run)                        */
  10. /*                                                                */
  11. /*  the setup strings you pass in here will be used as the default */
  12. /* when the user hits the default button.                         */
  13. /* -------------------------------------------------------------- */
  14.  
  15. Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs';
  16. Call SysLoadFuncs;
  17.  
  18.      /* creating folder to contain network objects and open it*/
  19.  
  20.      rc = SysCreateObject( 'WPFolder', 'NetProg Objects','<WP_DESKTOP>', ,
  21.                            'OBJECTID=<NET_FLDR>;OPEN=ICON', ,
  22.                            'ReplaceIfExists');
  23.  
  24.     /* WARNING: do not put spaces between keywords and the semi colon
  25.      * in your setup strings.  workplace doesn't handle that well.
  26.      */
  27.  
  28.  
  29.      /* here is an example of how to create a network program.
  30.       * OBJECTID is used so you can find the object again. Try to
  31.       *          avoid using objectids when possible and stick to persistent
  32.       *          HOBJECT returned from SysCreateObject.
  33.       * NETNAME  is the network location.  use UNC format or alias name.
  34.       * USEALIAS Not used anymore.  Netprog is smarter now...
  35.       * PROGRAMPATH is path of program w/o net name.  starts with '\'
  36.       *
  37.       *  VERY IMPORTANT!!! Do not use EXENAME= supported by the WPProgram
  38.       *    class... use PROGRAMPATH=
  39.       *
  40.       * LANDRIVE is requested drive to net use for program path.
  41.       *          if not specified, set to '*' which means any drive.
  42.       *
  43.       * WDNETNAME same as NETNAME but for working directory.  If WD setup
  44.       *           is not specified, it defaults to program path.
  45.       * WDUSEALIAS Not used anymore.  Netprog is smarter now...
  46.       * WDLANDRIVE same as LANDRIVE for working dir
  47.       * WORKINGDIR Working directory path w/o net name. starts with '\'
  48.       *
  49.       * ENVREPLACE  replace following environment string
  50.       * ENVAPPEND   append following environment string to current environment
  51.       *             of the shell.
  52.       * ENVPREPEND  prepend following environment string to current environment
  53.       *             of the shell.
  54.       *     example: ENVREPLACE PATH=C:\MYPATH^;C:\ANOTHERPATH^;
  55.       *  (use ^ before ';' that are included in the string.  this is
  56.       *   because the separator for setup strings is semi-colon)
  57.       *   you must provide proper separator in the BEGINNING of env. string
  58.       *   for ENVAPPEND for any env variable other than PATH and DPATH.
  59.       *   Also provide proper separator at the END for ENVPREPEND for
  60.       *   env variables other than PATH and DPATH.
  61.       *
  62.       *   NetProg will automatically fix separator placement for PATH or
  63.       *   DPATH on execution.
  64.       *
  65.       *   Also, '?' gets replaced on execution with program network drive
  66.       *   and '~' gets replaced on executaion with working dir network drive
  67.       *   e.g. ENVREPLACE PATH=?:\MYPATH;~:\ANOTHER => PATH=Z:\MYPATH;Y:\ANOTHER;
  68.       *
  69.       *
  70.       *
  71.       *
  72.       * NOTE: env strings only work for OS/2 programs.  (not DOS or WIN-OS/2)
  73.       *
  74.       * all these setup key values can also be set by the user through
  75.       * the setup notebook Program page, Working Dir page, and
  76.       * Environment page.
  77.       *
  78.       *  RUNBEFORE=  fully qualified path for .cmd file to run before starting
  79.       *              this network program.
  80.       *
  81.       *  RUNAFTER=   fully qualified path for .cmd file to run after starting
  82.       *              this network program.
  83.       *
  84.       *  RUNBEFORESTYLE=  INSTALL  run only once for this program and never
  85.       *                            again.
  86.       *
  87.       *         (default) ONCE     do not run when there is already an instance
  88.       *                            of the program running.  (like for net uses.
  89.       *                            if there are many instances, the net uses
  90.       *                            don't need to be done again)
  91.       *
  92.       *                   MULTIPLE run every time an instance is executed.
  93.       *
  94.       *  RUNAFTERSTYLE=   ONCE     do not run when there is already an instance
  95.       *                  (default) of the program running.  (like for net uses.
  96.       *                            if there are many instances, the net uses
  97.       *                            don't need to be done again)
  98.       *
  99.       *                   MULTIPLE run every time an instance is executed.
  100.       *
  101.       *  EXTRADRIVES= specify extra drives to be net used
  102.       *               this is in the form of netname^D^n,netname^D^n;
  103.       *
  104.       *     netname can be an alias or UNC path
  105.       *     D is the drive letter desired ('*' for any) this is required.
  106.       *     n is a number to assign this drive if you are using * and want
  107.       *       to also use substitution in env strings.  (you can only have
  108.       *       9 of these 1-9)  the ^n is optional.
  109.       *     ^ separates netname, drive letter, and number
  110.       *     , separates each separate extra drive requested
  111.       *
  112.       *  EXAMPLE: EXTRADRIVES=myalias^*^1,\\myserv\myshare^Q;ENVREPLACE PATH=?1\mypath;
  113.       *
  114.       *  here I want myalias assigned to any drive given the drive number
  115.       *  1 so it can be replaced in my PATH statement for ENVREPLACE.
  116.       *  note I used ?1\  the '?' tells netprog to substitute the drive
  117.       *  and the '1' following directly after means use extra drive 1
  118.       *  (if you don't put the number the program path drive will be used)
  119.       *  NOTE: don't put a colon.  I will replace the '?' with the drive letter
  120.       *      and the '1' or whatever number with a ':'.  This makes my life
  121.       *      easier when substituting characters.
  122.       *
  123.       *
  124.       *
  125.       *  RUNIFFAIL = YES  if any or all of extra drives fail to get accessed
  126.       *                   message goes up but program will still run.
  127.       *              NO   message goes up program does not run.
  128.       *                   NOTE: this is for extra drives ONLY!!!
  129.       *
  130.       *
  131.       *  NOTE: netprog is a descendent from the workplace default WPProgram
  132.       *        class.  All keywords (except for EXENAME and STARTUPDIR )
  133.       *        are supported.  One useful one is PARAMETERS=
  134.       *
  135.       *  example "PARAMETERS=these are my parameters"
  136.       *   specify as many parameters you want with blanks between them
  137.       *   (don't put a semi colon in it)
  138.       *
  139.       *  RUNBACKGROUND = YES  run the command files in the background
  140.       *                  NO (default) run them in foreground
  141.       *
  142.       */
  143.      rc=SysCreateObject('NetProg','Network Program 1', '<NET_FLDR>', ,
  144.                 'OBJECTID=<NetProg1>;NETNAME=\\server\resource;PROGRAMPATH=\dir1\dir2\program.exe;LANDRIVE=q;WDNETNAME=\\server2\resource2;WDLANDRIVE=r;WORKINGDIR=\temp;', ,
  145.                 'ReplaceIfExists');
  146.  
  147.      /* for above object 1:
  148.       * OBJECTID=<NetProg1>       assign object id so we can find this one later
  149.       * NETNAME=\\server\resource  UNC path for network name
  150.       * PROGRAMPATH=\dir1\dir2\program.exe  program path (must have '\' in front)
  151.       * LANDRIVE=q                requested LAN drive
  152.       * WDNETNAME=\\server2\resource2  Working dir path
  153.       * WORKINGDIR=\temp               working dir (must have '\' in front)
  154.       */
  155.  
  156.      If rc <> 1
  157.         Then Do;
  158.           Say  "NetProg: could not create its object, either an error occured or the object exists";
  159.           End;
  160.         Else Do;
  161.           Say "Network Program object 1 created OK.";
  162.           End;
  163.  
  164.      /* some programs require extra dos settings (see dos settings or
  165.       * windows settings on session page in settings notebook)
  166.       *
  167.       * here's an example that raises the DPMI_MEMORY_LIMIT of a fake
  168.       * windows executable called WINAPP.EXE on a LAN alias called WINAPPS
  169.       */
  170.  
  171.      rc=SysCreateObject('NetProg','Network Program 2', '<NET_FLDR>', ,
  172.              'SET DPMI_MEMORY_LIMIT=64;OBJECTID=<NetProg2>;NETNAME=WINAPPS;PROGRAMPATH=\APPS\WINAPP.EXE;LANDRIVE=l', ,
  173.              'ReplaceIfExists');
  174.  
  175.      /* for above object 2:
  176.       * SET DPMI_MEMORY_LIMIT=64      one of many dos settings you could use
  177.       * OBJECTID=<NetProg2>           unique object id for this object
  178.       * NETNAME=WINAPPS               network alias name
  179.       * PROGRAMPATH=\apps\winapp.exe    program path
  180.       * LANDRIVE=l                    requested lan drive
  181.       *
  182.       * no working dir for this object.
  183.       */
  184.  
  185.  
  186.      If rc <> 1
  187.        Then Do;
  188.           Say  "NetProg: could not create its object, either an error occured or the object exists";
  189.           End;
  190.         Else Do;
  191.           Say "Network Program object 2 created OK.";
  192.           End;
  193.  
  194.      rc=SysCreateObject('NetProg','Network Program 3', '<NET_FLDR>', ,
  195.              'ENVREPLACE PATH=C:\MYPATH^;C:\ANOTHERPATH;ENVPREPEND HELP=C:\MYHELP^;;ENVAPPEND MYVAR=,Var with comma separator;OBJECTID=<NetProg3>;NETNAME=OS2APPS;PROGRAMPATH=\APPS\OS2APP.EXE;LANDRIVE=l', ,
  196.              'ReplaceIfExists');
  197.  
  198.      /* for above object 3:
  199.       *
  200.       * ENVREPLACE PATH=C:\MYPATH^;C:\ANOTHERPATH   replace path in
  201.       *                     environment. (note '^' to denote ';' in string)
  202.       * ENVPREPEND HELP=C:\MYHELP^;   prepend C:\MYHELP; to current env.
  203.       *                       (note "^;" at end for prepend)
  204.       * ENVAPPEND MYVAR=,Var with comma separator    This is a dummy env var
  205.       *                        that uses ',' as separator. (note: added to
  206.       *                        beginning for append)
  207.       */
  208.  
  209.  
  210.      If rc <> 1
  211.        Then Do;
  212.           Say  "NetProg: could not create its object, either an error occured or the object exists";
  213.           End;
  214.         Else Do;
  215.           Say "Network Program object 3 created OK.";
  216.           End;
  217.  
  218.      rc=SysCreateObject('NetProg','Network Program 4', '<NET_FLDR>', ,
  219.              'RUNBEFORE=C:\runbef.cmd;RUNAFTER=c:\runaft.cmd param1;RUNBEFORESTYLE=MULTIPLE;RUNAFTERSTYLE=MULTIPLE;RUNFOREGROUND=NO;OBJECTID=<NetProg4>;NETNAME=OS2APPS;PROGRAMPATH=\APPS\OS2APP.EXE;LANDRIVE=l', ,
  220.              'ReplaceIfExists');
  221.  
  222.      /* for above object 4:
  223.       *
  224.       *  RUNBEFORE   c:\runbef.cmd will be run before netprog is executed.
  225.       *
  226.       *  RUNAFTER    c:\runaft.cmd will be run after netprog is executed (param1
  227.       *              is passed as parameter.  can have any # of params.
  228.       *
  229.       *  RUNBEFORESTYLE  multiple so even if there is already an instance of
  230.       *                  the program running, runbef.cmd will still run when
  231.       *                  a second one is opened.
  232.       *
  233.       *  RUNAFTERSTYLE   multiple for runaft.cmd (same as above)
  234.       *
  235.       *  RUNFOREGROUND   =NO - don't run this .cmd file in the foreground.
  236.       */
  237.  
  238.  
  239.      If rc <> 1
  240.        Then Do;
  241.           Say  "NetProg: could not create its object, either an error occured or the object exists";
  242.           End;
  243.         Else Do;
  244.           Say "Network Program object 4 created OK.";
  245.           End;
  246.  
  247. Exit;
  248.