mIRC Homepage

$fline - case sensitive ??

Posted By: WarlockW

$fline - case sensitive ?? - 04/10/05 02:17 PM


$fline - case sensitive ??

or am i nuts ?

anyway to make it NOT-case sensitive ??

Thanks ..
Posted By: Om3n

Re: $fline - case sensitive ?? - 04/10/05 02:42 PM

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.
Posted By: FiberOPtics

Re: $fline - case sensitive ?? - 04/10/05 03:15 PM

$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.
Posted By: WarlockW

Re: $fline - case sensitive ?? - 04/10/05 05:34 PM

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 ?
Posted By: Riamus2

Re: $fline - case sensitive ?? - 04/10/05 06:20 PM

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.
Posted By: WarlockW

Re: $fline - case sensitive ?? - 04/10/05 06:32 PM

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 ..
Posted By: Riamus2

Re: $fline - case sensitive ?? - 04/10/05 06:53 PM

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*
Posted By: WarlockW

Re: $fline - case sensitive ?? - 04/10/05 07:11 PM

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
Posted By: Riamus2

Re: $fline - case sensitive ?? - 04/10/05 07:22 PM

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.
Posted By: WarlockW

Re: $fline - case sensitive ?? - 04/10/05 07:36 PM

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
Posted By: Riamus2

Re: $fline - case sensitive ?? - 04/10/05 07:46 PM

What mIRC version are you using? Perhaps it has been changed at some point.
Posted By: WarlockW

Re: $fline - case sensitive ?? - 04/10/05 07:50 PM

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 ?
Posted By: Om3n

Re: $fline - case sensitive ?? - 04/10/05 08:08 PM

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.
Posted By: Riamus2

Re: $fline - case sensitive ?? - 04/10/05 08:11 PM

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?
Posted By: WarlockW

Re: $fline - case sensitive ?? - 04/10/05 09:41 PM

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
Posted By: MikeChat

Re: $fline - case sensitive ?? - 04/10/05 10:04 PM

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.
Posted By: WarlockW

Re: $fline - case sensitive ?? - 04/10/05 10:18 PM

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 ..
Posted By: MikeChat

Re: $fline - case sensitive ?? - 04/10/05 10:46 PM

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
Posted By: WarlockW

Re: $fline - case sensitive ?? - 04/10/05 10:52 PM

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
Posted By: Riamus2

Re: $fline - case sensitive ?? - 05/10/05 01:00 PM

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.
Posted By: WarlockW

Re: $fline - case sensitive ?? - 06/10/05 05:12 AM


I gave Up On this ..

I re-wrote it to use the : $filter command ..

just could not get the other to work ..

Anyway Thanks .. For All The Help smile
Posted By: FiberOPtics

Re: $fline - case sensitive ?? - 16/10/05 02:19 AM

You mean I wrote the /filter for you grin
© 2022 mIRC Discussion Forums