mIRC Home    About    Download    Register    News    Help

Print Thread
Removing wunwanted lines from a custom window #42190 16/08/03 08:14 PM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
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
}
}




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Re: Removing wunwanted lines from a custom window #42191 16/08/03 09:04 PM
Joined: Jan 2003
Posts: 150
J
J0ke Offline
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
So what data is incomming?


Go ahead, jump. 100,000 lemmings can't be wrong.
Re: Removing wunwanted lines from a custom window #42192 16/08/03 09:37 PM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
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\
=================




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Re: Removing wunwanted lines from a custom window #42193 16/08/03 11:11 PM
Joined: Jan 2003
Posts: 150
J
J0ke Offline
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
So you need smth like this?
Code:
alias getl {
  var %e = $line(@test,0)
  var %i = 0
  while (%i &lt; %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
  }
}


Go ahead, jump. 100,000 lemmings can't be wrong.
Re: Removing wunwanted lines from a custom window #42194 17/08/03 12:38 AM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
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)
Code:
  [color:red]  
alias getl {
  var %e = $line(@test,0)
  var %i = 0
  while (%i &lt; %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]  






Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Re: Removing wunwanted lines from a custom window #42195 17/08/03 12:47 AM
Joined: Jan 2003
Posts: 150
J
J0ke Offline
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
yeahh forgot about that grin
variable can't hold that much data...


Go ahead, jump. 100,000 lemmings can't be wrong.
Re: Removing wunwanted lines from a custom window #42196 17/08/03 01:02 AM
Joined: Jan 2003
Posts: 150
J
J0ke Offline
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
ok try this

Code:
alias getl {
  /remini test.ini test lines
  var %e = $line(@test,0)
  var %i = 0
  while (%i &lt; %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...


Go ahead, jump. 100,000 lemmings can't be wrong.
Re: Removing wunwanted lines from a custom window #42197 17/08/03 01:04 AM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
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?

Code:
 [color:red] 

alias -l Test {
  var %count = 1 , %line
  while (%count &lt;= $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]   




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Re: Removing wunwanted lines from a custom window #42198 17/08/03 01:12 AM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
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)




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Re: Removing wunwanted lines from a custom window #42199 17/08/03 01:17 AM
Joined: Jan 2003
Posts: 150
J
J0ke Offline
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
lol... how much data are you parsing?


Go ahead, jump. 100,000 lemmings can't be wrong.
Re: Removing wunwanted lines from a custom window #42200 17/08/03 01:22 AM
Joined: Jan 2003
Posts: 150
J
J0ke Offline
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
better paste all script...


Go ahead, jump. 100,000 lemmings can't be wrong.
Re: Removing wunwanted lines from a custom window #42201 17/08/03 01:38 AM
Joined: Jan 2003
Posts: 150
J
J0ke Offline
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
:tongue: guess I better go sleep... Brain malfunction...

Last splash of creativity... crazy

Code:
alias getl {
  var %e = $line(@test,0)
  while (%e != 0) {
    if ($left($gettok($line(@test,%e),1,32),1) != $chr(33)) {
      dline @test %e
    }
    /dec %e
  }
}


grin grin grin


Go ahead, jump. 100,000 lemmings can't be wrong.
Re: Removing wunwanted lines from a custom window #42202 17/08/03 02:09 AM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
That is simular to my original post but DLINE will not work if the line is $NULL






Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Re: Removing wunwanted lines from a custom window #42203 17/08/03 02:34 AM
Joined: Jan 2003
Posts: 150
J
J0ke Offline
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
I tested my version and it's working grin


Go ahead, jump. 100,000 lemmings can't be wrong.
Re: Removing wunwanted lines from a custom window #42204 17/08/03 03:17 AM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
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




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Re: Removing wunwanted lines from a custom window #42205 17/08/03 07:14 AM
Joined: Dec 2002
Posts: 169
J
Jerk Offline
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 169
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 !*

Re: Removing wunwanted lines from a custom window #42206 17/08/03 07:45 AM
Joined: Jan 2003
Posts: 150
J
J0ke Offline
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
<--- sleepyhead grin


Go ahead, jump. 100,000 lemmings can't be wrong.
Re: Removing wunwanted lines from a custom window #42207 17/08/03 04:12 PM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
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




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Re: Removing wunwanted lines from a custom window #42208 17/08/03 04:20 PM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
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 !*




Intelligence: It's better to ask a stupid question, then to prove it by not asking....