home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / os2 / programm / 3701 < prev    next >
Encoding:
Text File  |  1992-07-21  |  1.9 KB  |  50 lines

  1. Newsgroups: comp.os.os2.programmer
  2. Path: sparky!uunet!stanford.edu!leland.Stanford.EDU!jasonc
  3. From: jasonc@leland.Stanford.EDU (Jason Campbell)
  4. Subject: Re: REXX WAITFOR cmd?
  5. Message-ID: <1992Jul22.054242.7886@leland.Stanford.EDU>
  6. Sender: news@leland.Stanford.EDU (Mr News)
  7. Organization: DSG, Stanford University, CA 94305, USA
  8. References: <9207182258.AA10355@cs.utexas.edu> <92202.121337SPS2@psuvm.psu.edu>
  9. Date: Wed, 22 Jul 92 05:42:42 GMT
  10. Lines: 38
  11.  
  12. In article <92202.121337SPS2@psuvm.psu.edu> Steven P. Sedlmeyer <SPS2@psuvm.psu.edu> writes:
  13. >In article <9207182258.AA10355@cs.utexas.edu>, HARPER@VTVM1.CC.VT.EDU (Scott
  14. >Harper) says:
  15. >>
  16. >>   What REXX command do I use to scan the system's output for a text string?
  17. >>   I would like REXX to invoke a program then wait for a specific string to
  18. >>   occur (a prompt) before continuing.  This is basically the same as the
  19. >>   WAITON function found in many communications package scripting languages...
  20.  
  21. >You might try something like the following
  22. >/* start a process and look for a string in stdout */
  23.  
  24. ....
  25.  
  26. >address cmd 'start command | RXQUEUE'  /* pipe stdout into rexx queue */
  27. >found = false            /* string not found */
  28. >Do until found           /* loop until we find string in stdout */
  29. >   pull line             /* pull line from queue */
  30.  
  31. This will probably seek input from the console when nothing is pending on
  32. the queue (at least I think the documentation says it will).  I'm not sure 
  33. what will happen when REXX is waiting on the console and data appears on 
  34. the queue.
  35.  
  36. At any rate, another solution, which will ignore keyboard input:
  37.  
  38. '@start <some-command-here> | RXQUEUE'
  39. do forever
  40.   s = linein("queue:")
  41.   if pos(target_string, s) > 0 then leave
  42. end
  43.  
  44.  
  45. Jason.
  46. -- 
  47. Jason Campbell | not talking for SU | "OS/2...saving the world thru software!"
  48. 1->  jasonc@leland.Stanford.EDU |2->  Prodigy: KSJB81e |3->  (415)497-3937
  49.                                          -- Antidisestablishmentarians unite!
  50.