mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2006
Posts: 164
V
vexed Offline OP
Vogon poet
OP Offline
Vogon poet
V
Joined: Feb 2006
Posts: 164
Ok i have this to log urls pasted in a channel, then realised that if the same url is pasted twice it still logs it, then i end up with a huge text file.
Can anyone help me so that it if a url matches one already in the text file (Matches every single character) It skips it?

Code:
on ^1:TEXT:*:#: { 
  var %input = $1-
  var %url $regml($regex(%input,/((?:ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*)/g))
  if ( $regml($regex(%input,/((?:ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*)/g)) && ( ($len(%url) > 51) )  ) { /tinyurl $regml($regex(%input,/((?:ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*)/g))
    write system\url.txt $regml(1)  
    echo -a $bit Url logged:00 $regml(1)  
    haltdef
  }
}


Thanks in advance.

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Code:
if ($read(system\url.txt,w,$regml(1)) == $null) { write system\url.txt $regml(1) }

Joined: Feb 2006
Posts: 164
V
vexed Offline OP
Vogon poet
OP Offline
Vogon poet
V
Joined: Feb 2006
Posts: 164
Excellent, thanks for that! smile


Link Copied to Clipboard