mIRC Homepage
Posted By: sparta @window menu - 19/01/06 08:32 PM
I trying to make a "log viewer" for mirc, the problem i have now is that i need mirc to identify how many "logs" i have marked in the window, then how to remove every highlighted log name..



I guess i need to do it with a loop, but i cant figure out how to identify how many logs are highlighted.. :tongue:
Posted By: DaveC Re: @window menu - 19/01/06 09:06 PM
$sline(@window,0) = total slected lines, $sline(@window,N) = contents of Nth selected line, $sline(@window,N).ln = line number of Nth selected line

PLEASE NOTE: if your going to cycle through all of them deleting them, then start from the LAST one and move backwards towards 1,
OR repeatedly delete the 1st one, untill no more exist.
BECAUSE as you delete the 6th selected line, then the 7th selected line becomes the 6th one.

* Im sure i just wrote something about this just before? maybe i amagined it.
Posted By: xDaeMoN Re: @window menu - 19/01/06 09:08 PM
I believe you just did.

https://forums.mirc.com/s...p;page=0#147149
Posted By: DaveC Re: @window menu - 19/01/06 09:27 PM
to early in the moring here for me, i remebered that, then thought, maybe it just dreamed it up, while writing this. :-<
Posted By: sparta Re: @window menu - 19/01/06 10:57 PM
Now i have solved that problem, now to next.
[/code]
alias rlog {
var %xi = 1
:start
.remove " $+ $dirlog $+ $sline(@Logviewer,%xi) $+ .log $+ "
inc %xi
if (%ix > %xi) { goto start }
else {
unset %xi
}
}
[/code]
when i have highlighted 5 logs, then it removes only 4 of them, not all 5, how do i solve that? :tongue:

;------------------- EDIT

Never mind, solver it.. thnx for the help on the things abow smile
Posted By: sparta Re: @window menu - 20/01/06 03:34 AM
New question..
i use this line:

dclick { set %tmp.log $wildtok($sline(@window,1), *, 1, 32) $+ .log | command }

working just fine if i dclick in the left part of the @window.. "window created with /window -akSl16 @window". that means i get two windows in one.. or how i should say, the code i have working just great on the right window part, but cant solve how it also should work on the left part of the @window, any ideas?
Posted By: DaveC Re: @window menu - 20/01/06 04:14 AM
The left side of the @window does NOT have that same functionality (built in). You may be able to use some 3rd party DLL to wield 2 listbox windows together. But a single window is very difficult to create the same effect on left and right side. I have done it (or close to it) using hotkeys, and manually inverting selected and unselected lines, Not a pleasent job.
Posted By: sparta Re: @window menu - 20/01/06 06:54 AM
one more question.. how the h*ll do i search true X amount of files in one folder after a word? lets say i have 50 *.txt files in one folder, now i want to search true all this 50 files for a word, how do i do that? been trying to solve it, but no go so far.. smirk and when i have been asking around on help channels, then i get reply to use filter, didnt work for me.. i also got the advice to use $read, still no go for me.. :tongue: "and give me the file name(s) the word exist in" confused
Posted By: RusselB Re: @window menu - 20/01/06 10:07 AM
Code:
 alias word.search {
var %a = 1, %b = $findfile(&lt;directory&gt;,*.txt,0)
while %a &lt;= %b {
var %file = $findfile(&lt;directory&gt;,*.txt,%a)
if $read(%file,w,$+(*,$chr(32),$1,$chr(32),*)) {
echo -a %file
}
inc %a
}
}
 


Usage: /word.search <word to be searched for>

There are other ways of doiing this, but this is what I was able to think of at 5:10 am
Posted By: sparta Re: @window menu - 20/01/06 07:29 PM
Nope, no go at that code.. dosent return me anything :tongue: and i changed the path, even tryed to change $1 to a %var instead..

;---------- EDIT

if $read(%file,w,$+(*,$chr(32),$1,$chr(32),*)) {

was replaced with:

if $read(%file,w,$+(* $+ $1 $+ *)) {

then it working.. smile
Posted By: DaveC Re: @window menu - 20/01/06 10:03 PM
your problem is with your failure to define everything well enough, your 50 plus files, sound like they have one word per line maybe, in which case "* <word> *" wouldnt have found them, but then russel wasnt to know your files had one word a line was he, you never said.

Now using "*<word>*" it well find "and" in "candle".

If u need to find exact words, please let us know of the exact formating of the files.
Posted By: sparta Re: @window menu - 21/01/06 01:43 PM
the format of the files is "*.log", when i was searching for a word i didnt look for the exact match, just if the word was in any of the files, and * $+ $1 $+ * did the trick, and i guess your code should have done something simulare, but didnt return anything, due to a full match or if the match was a part of the word.
© mIRC Discussion Forums