home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / os2 / misc / 42097 < prev    next >
Encoding:
Internet Message Format  |  1993-01-12  |  3.5 KB

  1. Xref: sparky comp.os.os2.misc:42097 comp.os.os2.apps:10082
  2. Path: sparky!uunet!torolab6.VNET.IBM.COM
  3. From: lansche@torolab6.VNET.IBM.COM (Martin Lansche)
  4. Message-ID: <19930112.092303.222@almaden.ibm.com>
  5. Date: Tue, 12 Jan 93 11:31:04 EST
  6. Newsgroups: comp.os.os2.misc,comp.os.os2.apps
  7. Subject: Re: Passing batch arguments to pgm (was: Neat timesaving trick.)
  8. Disclaimer: This posting represents the poster's views, not those of IBM
  9. News-Software: UReply 3.0
  10. References: <4fIYJ=W00WBOQ890hA@andrew.cmu.edu>
  11.             <1993Jan12.141847.19646@cbnews.cb.att.com>
  12. Lines: 67
  13.  
  14. In <1993Jan12.141847.19646@cbnews.cb.att.com> larry.a.shurr writes:
  15. >In article <4fIYJ=W00WBOQ890hA@andrew.cmu.edu> sl31+@andrew.cmu.edu (Stephen M. Lacy) writes:
  16. >}I was just playing around with my computer again (gee, guess why I'm a
  17. >}CS major)
  18. >}So, I have e.cmd which looks like
  19. >}@start \os2\e %1 %2 %3 %4 %5 %6 %7 %8 %9
  20. >}(is there an easier way than making all the %'s?)
  21. >
  22. >If you were to use 4OS2 instead of CMD, you could then rewrite this as:
  23. >
  24. >@start \os2\e %&
  25. >
  26. >Larry
  27.   An alternative, which requires only OS/2, is the REXX versions of
  28. Stephen's BATch file.  It is not as terse as Larry's alternative, but
  29. then, I don't have to add 4OS2 to my system.  Of course, \os2\e doesn't
  30. have the ability for accepting more than one file at a time, so I am
  31. unsure just what Stephen's batch file was meant to do (nor Larry's 4OS2
  32. command) with the extra parameters.  Here is the 3 line REXX CMD file:
  33.  
  34. /* Just to let the command interpretor know that this file is REXX */
  35. parse arg file
  36. "start \os2\e" file
  37.  
  38. Of course, I could enhance this to say, invoke "e" for most files, "epm"
  39. for all my .C, .CPP, .H, and .DEF files, and "WordPerfect" for all my
  40. .DOC files....
  41.  
  42. /* Just to let the command interpretor know that this file is REXX */
  43. parse arg line
  44. e_line = ""
  45. epm_line = ""
  46. wp_line = ""
  47. do i = 1 to words(line)
  48.   full_file_name = word(line,i)
  49. /* you may want to parse the name from backwards from the end for HPFS
  50.    names such as long_name.with.multiple.periods.doc  - this file will
  51.    not be correctly handled with the code below.  It is left as an
  52.    exercise to the reader ;) */
  53.   parse filespec("file",full_file_name) . '.' ext
  54.   select
  55.     when ext = 'DOC' then wp_line = wp_line full_file_name
  56.     when ext = 'C' | ext = 'CPP' | ext = 'H' | ext = 'DEF'
  57.        then epm_line epm_line full_file_name
  58.     otherwise e_line = e_line full_file_name
  59.   end
  60. end
  61. /* I don't know if WordPerfect will handle more than one file as args,
  62.    but I will assume that it will */
  63. if wp_line <> "" then "@start D:\WP\WP.EXE" wp_line
  64. /* EPM does handle multiple file arguments. */
  65. if epm_line <> "" then "@start C:\OS2\APPS\EPM.EXE" epm_line
  66. /* e.exe does not appear to accept more than one file, but for illustrat-
  67.    ion purposes -  you could put this in the loop above, one start for
  68.    every file found */
  69. if e_line <> "" then "@start C:\OS2\E.EXE" e_line
  70.  
  71. Cheers,
  72. Martin Lansche, IBM Toronto Lab, Canada
  73.   ________________________________________________________________________
  74.    Ilu Iluvatar en kare eldain a firimoin ar antarota mannar valion :
  75.    numessier.  Toi aina, mana, meldielto -- enga morion : talantie.
  76.    ----------------------------------------------------------------------
  77.    The father made the world for elves and mortals and he gave it into
  78.    the hands of the Lords in the West.  They are blessed, holy and loved,
  79.    except the black one.  He has fallen.  (J.R.R. Tolkien).
  80.   ________________________________________________________________________
  81.