mIRC Home    About    Download    Register    News    Help

Print Thread
#130617 19/09/05 10:04 PM
Joined: Aug 2005
Posts: 25
E
enotsoc Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Aug 2005
Posts: 25
ok im logging urls ( *http* and *www* ) posted in a channel by certain nicks, and using is along with the search trigger, what would be the best way to trim the log to a specific amount of lines so that the older lines are auto deleted.
that way i wont have to worry about dead links as much.
All help is very appreciated.

#130618 19/09/05 10:46 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Could you please post the code that you're using to log the urls. I'm not positive, but I suspect it would be easier to modify your current code rather than try to supply you with code that you would add to your current code. Just a hunch, but I've learned to trust hunches like this regarding code/scripts.

#130619 19/09/05 10:56 PM
Joined: Feb 2005
Posts: 681
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
Just make an alias to do it

Syntax: /trimlog <N> <file name>

alias trimlog {
var %l = $lines($2-)
while (%l > $1) {
write -d $+(",$2-,")
dec %l
}
}

#130620 19/09/05 11:52 PM
Joined: Aug 2005
Posts: 25
E
enotsoc Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Aug 2005
Posts: 25
on *:TEXT:*http*:#: {
%checkiffound2 = $read(urls.ini, w, $1- )
%checkdupe = $readn
if ( $nick == NICK1 && %checkdupe == 0 ) write -il1 urls.ini $strip($1-)
}

that is the logging code, very simple , it also checks for dupe urls but i have no clue how to have it auto trim the log once the max level is reached, just need it to bump the older lines as the new ones are added. the alias to manually do it is cool, but i dont realy want to have to do it myself rather the same way mirc does internally trim to a set size log , as long as it remove the oldest lines to make room for the new and keep the set log size

#130621 20/09/05 12:06 AM
Joined: Feb 2005
Posts: 681
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
on *:TEXT:*http*:#: {
%checkiffound2 = $read(urls.ini, w, $1- )
%checkdupe = $readn
if ( $nick == NICK1 && %checkdupe == 0 ) {
write -il1 urls.ini $strip($1-)
trimlog 100 urls.ini
}
}

alias trimlog {
var %l = $lines($2-)
while (%l > $1) {
write -d $+(",$2-,")
dec %l
}
}

Change the 100 to whatever you want


Link Copied to Clipboard