mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Joined: Jan 2004
Posts: 133
W
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133

$fline - case sensitive ??

or am i nuts ?

anyway to make it NOT-case sensitive ??

Thanks ..

Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
It doesn't seem to be case sensitive to me. Remember you have to take into concideration the spacing and control codes.

/window @test
/aline @test test motd
/aline @test motd test
//echo $fline(@test,*MOTD*,0) returns 2 (total number of matching lines)
//echo $fline(@test,*motd*,0) returns 2 (total number of matching lines)

If you want case sensitive search you could use a regular expression.


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
$fline is not case sensitive, unless you specify 2 or 3 as fourth parameter, which indicates that the matchstring is a regex pattern, which is indeed case sensitive.


Gone.
Joined: Jan 2004
Posts: 133
W
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133
i am using it to find a line in acustom window and
diplay the text ..

set %findtxt $fline(@text,%text-to-find,1-100,2)
^^ this works how ever its case sensitve

i have tried many different combinations..
set %findtxt $fline(@text,%text-to-find,1-100,0)
set %findtxt $fline(@text,%text-to-find,1-100,1)
set %findtxt $fline(@text,%text-to-find,1-100,2)
set %findtxt $fline(@text,%text-to-find,1-100,3)
^^ none work

I need to find the text i a custom window window is set at:
window -alkCs @text


Any thoughts ?

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
As mentioned, 2 and 3 are going to be case sensitive because they are regex. 1 should probably work, but why not just try without the fourth parameter? 0 isn't listed as a possible parameter, though I haven't tried it to see if it would do anything.

You should try manually doing it from the command line...

//echo -a $fline(@text,%text-to-find,1-100,1)
//echo -a $fline(@text,%text-to-find,1-100)

Make sure you set %text-to-find to something first and then see if you get any output from a valid search.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2004
Posts: 133
W
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133
yea sorry ..

i did try ..

//echo -a $fline(@text,%text-to-find,1-100)
also .. didnt get a result at all ;(

Hmmm i agree it should work ..
but doesnt seem to ..

Could it be the typ of window i am using ?

thanks for the help ..

Last edited by WarlockW; 04/10/05 06:33 PM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Well, here's my test:

Creating test window:
/window -alkCs @test
/aline @test this is a test
/aline @test this is another test
/aline @test I am testing again
/aline @test Are you testing?
/aline @test THIS IS A TEST
/set %text-to-find this is a test

Testing:
//echo -a $fline(@test,%text-to-find,0)
2

That's the correct results for total matches. From testing it, I find that you cannot use a range with $fline. 1-100 will not work. Here's a simple loop to get them:

Code:
var %c = 1
var %i = $fline(@test,%text-to-find,0)
while (%c <= %i) {
  echo -a Line # $+ $fline(@test,%text-to-find,%c) $+ : $line(@test,$fline(@test,%text-to-find,%c))
  inc %c
}


That should echo your results for you and will not be case sensitive.

REMINDER: Without using *'s, this will search only for exact matches. If %text-to-find is "this", it will not find any matches. If you want to use partial searches, you have two choices...

1) In all your $fline sections, replace %text-to-find with * $+ %text-to-find $+ *

or

2) When setting your %text-to-search, use wildcards in it...

Example:

/set %text-to-search this*
or
/set %text-to-search *this*

Last edited by Riamus2; 04/10/05 06:57 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2004
Posts: 133
W
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133
omg .. i am soo dumb ..
i am sorry ...

I think i didnt make myself clear!
I am trying to search for a line with it being the ONLY line
with the text in it .. all lines are different!

so .. if i search for: test
i need it to give me the line number of the line with text < in it .. now remember all lines are different so only ONE line has the word: text

I need the line number so i can use :
set %linetxt $line(@text,%linenumber)
echo %linetxt

Or am i useing the totaly wrong way to do this lol

Does that make any secence ? lol

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
If you want exact matches and you'll only ever have one match, then this should work:
Code:
echo -a Line # $+ $fline(@test,%text-to-find,1) $+ : $line(@test,$fline(@test,%text-to-find,1))

If you want them in variables:
Code:
set %linenumber $fline(@test,%text-to-find,1)
set %linetext $line(@test,%linenumber)


Note that if you didn't set %linenumber, you'd need to replace %linenumber in the %linetext section with the code from %linenumber.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2004
Posts: 133
W
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133
well .. i dono whats wrong ..

dont work for me ..
the only way i can make it work is to use :

set %findtxt $fline(@text,%text-to-find,1-100,2)
echo %findtxt

this works .. but is case sensitve ..
I know .. but true ..

maybe i will have to save it to a txt file and do a search from there ..

Anyway .. I really thank you for your help!
you have been great putting up with me smile

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
What mIRC version are you using? Perhaps it has been changed at some point.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2004
Posts: 133
W
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133
6.16

newest i think ..

did you try my exsample ?
set %findtxt $fline(@text,%text-to-find,1-100,2)
it also seems if i dont use the 1-100 part
it also doent work :P

do you get what i get ? Just wondering ?

Last edited by WarlockW; 04/10/05 07:54 PM.
Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
You are using ranges in the 3rd parimater again. 1-100 is not valid, just use the number 1 and it will return the first exact match. Also, you are specifying the number 2 as the 4th parimater, this means it does a regular expression search. Is the contents of %text-to-find a regular expression? There is a very big difference between a wildcard search and a regular expression.

If the contents of %text-to-find is plain text or wildcard text, just use "$fline(@text,%text-to-find,1)", without the invalid range, and without the 4th parimater. If the contents of the variable is a regular expression, then use "$fline(@text,%text-to-find,1,2)" and make sure that your regular expression syntax is correct.


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Your example WILL be case sensitive as you're using "2" which is regex and is case sensitive.


Use these with the test I did from above. You should get 3 as the output. If it's case sensitive, you should get 4 as the output.
//set %text-to-find this is a test
//set %findtxt $fline(@text,%text-to-find,1)
//echo -a %findtxt

This works just fine and searches without case sensitivity. You never have to change any part of the $fline in my example there.

Try typing the entire test I displayed above. Then, use this example. Note that you have to change both to use @test or both to use @text and both are used in this thread.

What do you get when doing this echo?

Last edited by Riamus2; 04/10/05 08:14 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2004
Posts: 133
W
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133
ok guys .. i know you think i am nuts ...

but i have tryied 1000 times and it does not work here ..

in your exsample Riamus2

i get nothing .. if i use :
/echo $me $fline(@text,%text-to-find,1)

If I use this it works but ..
/echo $me $fline(@text,%text-to-find,1,2)
then its case sensitive
reply = 57
I asume that means line 57

I know this may not make sence but true ;(
has to be the type of window ? or because i am dumb ? lol

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
you mentioned a few times in your posts you think it might be the switches you have on the window (you called it window type) it might be, but you have not shown us the /window command that you use

post that line so we can take a look and see what in there might be conflicting.

Joined: Jan 2004
Posts: 133
W
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133
window -alkCs @text

is what i used .. from what i can tell .. been awile
is there a way to get the windows parms?

but i amd 90% sure thats was what i used ..

this is kinda fustrating be cause i need to have controls
if this that happens ect.

if i save the window text to a txt file
and if i use the filter / play command to search
( btw works )

i cant get the controls i need .. i think anyway ..
cause i am not great at this stuff .. but know enough to be
dangerus lol

anyway thanks again ..

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
ok
despite what the help file says my results were:

/window -alkCs @text
//loadbuf @text $sfile(*.log)

//echo -a $line(@text,$fline(@text,stock*,1,2),1) $fline(@text,stock*,1)
no line number

//echo -a $line(@text,$fline(@text,stock*,1,2),1) $fline(@text,stock*,1,1)
no line number

//echo -a $line(@text,$fline(@text,stock*,1,2),1) $fline(@text,stock*,1,2)
returns "27"

//echo -a $line(@text,$fline(@text,stock*,1,2),1) $fline(@text,stock*,1,3)
returns "27"

/me shrugs

Joined: Jan 2004
Posts: 133
W
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133
weird huh ?

anyway thanks ..

its easy to see how this stuff can drive people to drink !

in your test i see you didnt try a cap letter
this also screws things up lol

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
MikeChat: He did show his /window switches. If you look above at my test, I used the exact same switches without any problem.

WarlockW: Try my test exactly as I typed it before. Use my examples for text to add into the window. Don't use your own. See what results you get.

Also, please paste your entire code that you are using. Include your code for making the window, adding lines to it, and trying to use $fline on it. Make sure you let us know what the lines you are adding are and what your %text-to-find variable is set to. If it is not working, it's some error in your code or else some other script causing a conflict.


Invision Support
#Invision on irc.irchighway.net
Page 1 of 2 1 2

Link Copied to Clipboard