From: lansche@torolab6.VNET.IBM.COM (Martin Lansche)
Date: Tue, 12 Jan 93 11:31:04 EST
Newsgroups: comp.os.os2.misc,comp.os.os2.apps
Subject: Re: Passing batch arguments to pgm (was: Neat timesaving trick.)
Disclaimer: This posting represents the poster's views, not those of IBM
News-Software: UReply 3.0
            <1993Jan12.141847.19646@cbnews.cb.att.com>

In <1993Jan12.141847.19646@cbnews.cb.att.com> larry.a.shurr writes:
>In article <4fIYJ=W00WBOQ890hA@andrew.cmu.edu> sl31+@andrew.cmu.edu (Stephen M. Lacy) writes:
>}I was just playing around with my computer again (gee, guess why I'm a
>}CS major)
>}So, I have e.cmd which looks like
>}@start \os2\e %1 %2 %3 %4 %5 %6 %7 %8 %9
>}(is there an easier way than making all the %'s?)
>
>If you were to use 4OS2 instead of CMD, you could then rewrite this as:
>
>@start \os2\e %&
>
>Larry
  An alternative, which requires only OS/2, is the REXX versions of
Stephen's BATch file.  It is not as terse as Larry's alternative, but
then, I don't have to add 4OS2 to my system.  Of course, \os2\e doesn't
have the ability for accepting more than one file at a time, so I am
unsure just what Stephen's batch file was meant to do (nor Larry's 4OS2
command) with the extra parameters.  Here is the 3 line REXX CMD file:

/* Just to let the command interpretor know that this file is REXX */
parse arg file
"start \os2\e" file

Of course, I could enhance this to say, invoke "e" for most files, "epm"
for all my .C, .CPP, .H, and .DEF files, and "WordPerfect" for all my
.DOC files....

/* Just to let the command interpretor know that this file is REXX */
parse arg line
e_line = ""
epm_line = ""
wp_line = ""
do i = 1 to words(line)
  full_file_name = word(line,i)
/* you may want to parse the name from backwards from the end for HPFS
   names such as long_name.with.multiple.periods.doc  - this file will
   not be correctly handled with the code below.  It is left as an
   exercise to the reader ;) */
  parse filespec("file",full_file_name) . '.' ext
  select
    when ext = 'DOC' then wp_line = wp_line full_file_name
    when ext = 'C' | ext = 'CPP' | ext = 'H' | ext = 'DEF'
       then epm_line epm_line full_file_name
    otherwise e_line = e_line full_file_name
  end
end
/* I don't know if WordPerfect will handle more than one file as args,
   but I will assume that it will */
if wp_line <> "" then "@start D:\WP\WP.EXE" wp_line
/* EPM does handle multiple file arguments. */
if epm_line <> "" then "@start C:\OS2\APPS\EPM.EXE" epm_line
/* e.exe does not appear to accept more than one file, but for illustrat-
   ion purposes -  you could put this in the loop above, one start for
   every file found */
if e_line <> "" then "@start C:\OS2\E.EXE" e_line

Cheers,
Martin Lansche, IBM Toronto Lab, Canada
  ________________________________________________________________________
   Ilu Iluvatar en kare eldain a firimoin ar antarota mannar valion :
   numessier.  Toi aina, mana, meldielto -- enga morion : talantie.
   ----------------------------------------------------------------------
   The father made the world for elves and mortals and he gave it into
   the hands of the Lords in the West.  They are blessed, holy and loved,
   except the black one.  He has fallen.  (J.R.R. Tolkien).
  ________________________________________________________________________
Newsgroups: comp.os.os2.misc