mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2011
Posts: 2
K
kdogg1 Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
K
Joined: May 2011
Posts: 2
Hi All,

Is there a way I can save the last line of text in the chat window to a variable?

I want to then email that to myself (if it contains certain words). But for this question I'd just like to know how to save the line of text to a variable.

Thank you :-)

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
There are a few ways.

$line(@name,N,T)

Returns the Nth line of text in the specified window. If N is zero, it returns the total number of lines in the window.

For some reason I thought /loadbuf took lines from a window and put them in a file. On second look I guess it's the other way around.

Anyways, $line($chan,0) is total number of lines, so $line(#,$line(#,0)) will return the last line in a channel window.

set %var $line(#,$line(#,0))

Joined: May 2011
Posts: 2
K
kdogg1 Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
K
Joined: May 2011
Posts: 2
Thank you DJ_Sol for your great answer.

I use an on TEXT event. I really want to capture this line of text that the on TEXT event is using. Will capturing the last line be sufficient to capture this?

Would %lineOfText = $1- work inside the on TEXT event? (just thinking, not near a desktop computer atm - only iPhone).

Thanks again.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yes, you can use $1- in a text event to capture the text. Keep in mind that the on text event only captures normal text. It does not capture what you say, actions (/me), notices, etc. If you need to capture more than just normal text, you'll need multiple events. As far as the variable goes, if you are using the information immediately, you can use /var %varname = $1- , but if you need to store it for later use, you need to use /set %varname $1- . /var is just a temporary variable for use in the event itself.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard