|
Joined: Dec 2002
Posts: 416
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 416 |
When I load a list into a custom window I get a bunch of unwanted information. I wrote this to strip out the unwanted information. But it seems I have to run it 3 times to clear all the unwanted lines out of the window. What I have done is if ! is not in first charitor of the line then it removes the line. but some of the lines use = or spaces the script seems to over look some of those lines. but it does remove some of them.
alias strip { var %count = 1 while ( %count <= $line(@test,0) ) { if ( $left($gettok($line(@test,%count),1,32),1) != $chr(33) ) { dline @test %count } inc %count } }
|
|
|
|
Joined: Jan 2003
Posts: 149
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 149 |
So what data is incomming?
|
|
|
|
Joined: Dec 2002
Posts: 416
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 416 |
When I load a list into my script some list contain headers and directories like this. I am trying to create a filter to remove the unwanted information. som list have more of a header then others. OmeNServE v1.40 © ^OmeN^ & ListMagic v1.0 © mp3oholic ( http://www.omenscripts.org ) List of 636 Files (2.2 Gb) generated on 15th Aug 2003 in 0m01s ( 636 Files Per Second )
To request a file, copy/paste to the channel... !^OmeN^ FILENAME eg. !^OmeN^ Madonna - Holiday.mp3 Or try the ultimate requesting script -=- AutoGet -=- Available from the above website
================= C:\mIRC\50 Cent\ =================
|
|
|
|
Joined: Jan 2003
Posts: 149
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 149 |
So you need smth like this?
alias getl {
var %e = $line(@test,0)
var %i = 0
while (%i < %e) {
/inc %i
if ($left($gettok($line(@test,%i),1,32),1) != $chr(33) ) {
/var %lines = $addtok(%lines,%i,32)
}
}
var %e = $gettok(%lines,0,32)
while (%e != 0) {
dline @test $gettok(%lines,%e,32)
/dec %e
}
}
|
|
|
|
Joined: Dec 2002
Posts: 416
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 416 |
yes something like that but when I tested that script in the window I get this error * /set: line too long (line 7, script3.mrc) [color:red]
alias getl {
var %e = $line(@test,0)
var %i = 0
while (%i < %e) {
/inc %i
if ($left($gettok($line(@test,%i),1,32),1) != $chr(33) ) {
[color:blue] /var %lines = $addtok(%lines,%i,32)[/color]
}
}
var %e = $gettok(%lines,0,32)
while (%e != 0) {
dline @test $gettok(%lines,%e,32)
/dec %e
}
}
[/color]
|
|
|
|
Joined: Jan 2003
Posts: 149
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 149 |
yeahh forgot about that  variable can't hold that much data...
|
|
|
|
Joined: Jan 2003
Posts: 149
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 149 |
ok try this
alias getl {
/remini test.ini test lines
var %e = $line(@test,0)
var %i = 0
while (%i < %e) {
/inc %i
if ($left($gettok($line(@test,%i),1,32),1) != $chr(33) ) {
/writeini test.ini test lines $addtok($readini(test.ini,test,lines),%i,44)
}
}
var %e = $gettok($readini(test.ini,test,lines),0,44)
while (%e != 0) {
dline @test $gettok($readini(test.ini,test,lines),%e,44)
/dec %e
}
}
dunno there is limit for line in ini file or not...
|
|
|
|
Joined: Dec 2002
Posts: 416
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 416 |
You can not add a token if the information is not there.... I have this same problem with two scripts This is the other script and when it runs across a empty line it hans on me. Using this script as an example when it gets to the rline the script hangs when the %line is empty. I have tried using If %line == $null But that will not work in this script.... any suggestions? [color:red]
alias -l Test {
var %count = 1 , %line
while (%count <= $line(@Test,0)) {
%line = $gettok($line(@Test,%count),1,32) $+ $chr(32) $+ $stripi($gettok($line(@Test,%count),2-,32))
var %lcnt = $gettok(%line,32)
echo -s %lcnt
rline @Test %count %line
inc %count
}
}
[/color]
|
|
|
|
Joined: Dec 2002
Posts: 416
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 416 |
That script gives me another error
* /writeini: line too long (line 8, script3.mrc)
/writeini test.ini test lines $addtok($readini(test.ini,test,lines),%i,44)
|
|
|
|
Joined: Jan 2003
Posts: 149
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 149 |
lol... how much data are you parsing?
|
|
|
|
Joined: Jan 2003
Posts: 149
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 149 |
better paste all script...
|
|
|
|
Joined: Jan 2003
Posts: 149
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 149 |
|
|
|
|
Joined: Dec 2002
Posts: 416
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 416 |
That is simular to my original post but DLINE will not work if the line is $NULL
|
|
|
|
Joined: Jan 2003
Posts: 149
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 149 |
I tested my version and it's working
|
|
|
|
Joined: Dec 2002
Posts: 416
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 416 |
what I sent will work but if you load a list to the custom window then try to remove the empty lines it will only remove some of the info past the file extention not the unwanted information
|
|
|
|
Joined: Dec 2002
Posts: 168
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 168 |
Just a quick guess...
Do not increase the counter if you delete a line. When you delete a line the next line becomes the old line number
Use if (!* !iswm $line(@test,%count)). No need to $gettok then.
Use /filter and do it all in one shot. /filter -ww @test @test !*
|
|
|
|
Joined: Jan 2003
Posts: 149
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 149 |
<--- sleepyhead
|
|
|
|
Joined: Dec 2002
Posts: 416
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 416 |
if you don't increase the counter then it will only delete one line then stop the problem is if a line is NULL $line will not work
|
|
|
|
Joined: Dec 2002
Posts: 416
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 416 |
Once again thank You Joke for your input. Sometimes its the simplest things we over look to make something so complicated that could of been so simple to obtain. Joke's suggestion to clearing the window was to use this filter
/filter -cww @test @test !*
|
|
|
|
|