Contents | Index | < Browse | Browse >


    xPIPE  PipeName  ON|OFF
   
  This is the event that will enable you to use the output
  that cli programs produce.

  Example :  Run Gui   Source 

  A PIPE: is an amigados device which exists in all versions
  of the OS from V2.0 and up (AFAIK). In order to be able to
  use it you MUST have the file PIPE in your DEVS/DOSDRIVERS
  directory and the Queue-handler in your L: dir. You probably
  already have them set up as above, as this is the standard 
  Amiga OS set-up.
  
  What a pipe: does, is provide a "holding place" for the
  output of CLI programs, until Gui4Cli can get around to
  reading it.
  
  PipeName - should be the name of a pipe: file
  ON|OFF   - is the starting state of the pipe (You can give
             the xPIPE a gadid and set it ON|OFF - or CLEAN it).
  
     xPIPE  PIPE:AnyName ON
  
  Thereafter, you can launch/run/cli any command and redirect
  it's output to this pipe: file, like so:

     RUN 'c:search >PIPE:AnyName dh0:MirrorOnWall FairestOfAll'
  
  Now, if the c:search program produces any output, this will
  go to the PIPE: file you stated and the above xPIPE event
  will "happen".
  
  Inside the xPIPE event, there is one internal variable which
  will be valid : $$PIPE.TXT. Every time the xPIPE event happens
  it will mean that an other line of text is ready for you and
  stored into this variable.
  
  ------------------- example:
  
  ; a button to start the search
  xButton 10 10 60 12 'Search'
    run 'c:Search >PIPE:SearchResults dh0:Universe TrueLove'
  
  ; the pipe event that the results will be sent to
  xPIPE PIPE:SearchResults ON
    say '$$PIPE.TXTn'
  
  
  In the above example, every time a line of text is output
  from the c:search command, it will be printed.
  
  
  ------------------- Handling a pipe -----------------------
  
  You can start off a gui with the pipe ON or OFF.
  
  If you give the pipe event a GADID, you can then switch it 
  ON or OFF or CLEAN it, at any time. These will have the 
  following effect :
  
  SetGad gui id ON    :  
     Will start (create) the pipe.
  
  SetGad gui id OFF   : 
     Will continue sending text to the xPIPE event and when all
     the text has been sent, it will delete the pipe.
  
  SetGad gui id CLEAN :
     Will immediately stop sending text to the xPIPE event, clean
     up any text that was in the pipe and go back to waiting for some
     text to be sent to it. It will not quit the pipe.
  
  If you want to immediately stop and quit the pipe, you can declare
  "SetGad gui id CLEAN" and then again "SetGad gui id OFF".
  
  
  ------------------- ** IMPORTANT ** -----------------------
  
  In order to implement the PIPE:, Gui4Cli will start a new process 
  which will sit quietly in the background and monitor the PIPE: file. 
  If any text comes, it will read it and send it to Gui4Cli line by line.
  
  That means there is quite a lot of overhead involved in each xPIPE you 
  declare (about 10k), so don't fill the place with them..
  
  YOU MAY WELL ask, "why should I use a pipe and not a simple file
  in ram: to redirect stuff to and then read it from there.."
  
  - Well, a pipe: is actually a file, but one which you can read
  while an other program may be writting to it (i.e. outputing text
  in to the pipe).
  
  - Moreover, a pipe will notify you when it has something to tell
  you, where as with a file you have to go check yourself.
  - (Unless I add an xOnNotify event - which I'm thiiiis much away 
    from persuading myself to do...)