[Gambas-user] How to create a graphical tail-like function

Benoit Minisini gambas at ...2...
Wed Jul 16 20:02:57 CEST 2003


Le Vendredi 11 Juillet 2003 18:38, Rob a écrit :
> On Wednesday 09 July 2003 07:59, Lasse Kim Christiansen wrote:
> > My initial problem is how i should create the tail function. Which will
> > open a file and continuously print new lines as they end up in the
> > syslog.
>
> Well, it's a little more than just a function, but you could just do
>
> EXEC [ "tail", "-f", "/var/log/syslog" ] FOR READ AS MyProcess
>
> and then
>
> public sub Process_Write(Data as string)
> 	' append the data to whatever display control you're using, and then...
> 	if Data like "somepattern" then Message.info(data)
> end
>
> Of course you could probably do things easier with the watched files
> functionality which I haven't tried yet.
>
> Benoit, I noticed when messing with that perl regex thing that the
> Process.Write event seems to be static, i.e. it calls Process_Write back
> rather than (for example) MyProcess_Write.  So if you have more than one
> process open all the output would end up in the same handler function.  Is
> this right?
>
> Rob
>

Yes. You can distinguish processes in the event handler with the LAST keyword.

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list