mIRC Home    About    Download    Register    News    Help

Print Thread
relay script #122701 14/06/05 03:04 AM
Joined: Jan 2005
Posts: 25
L
LordoftheX Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Jan 2005
Posts: 25
I am trying (unsuccessfully) to write a script that will snag every url it sees and send it to another channel

Re: relay script #122702 14/06/05 05:15 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
on *:text:*:#chan1:{
if (http iswm $1-) || (www iswm $1-) { .msg #chan2 $1- }
}
 

I think that should do what you're asking for. I accept no responsibility for usage of this code on channels that don't allow URL advertising.

Replace #chan1 with the name of the channel you want to monitor and #chan2 with the name of the channel you want the information sent to

Re: relay script #122703 14/06/05 05:29 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
bugfix replace ISWM with ISIN

Re: relay script #122704 14/06/05 01:26 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
This is probably a bulky and perhaps not quite correct way to do this, but it appears to work...

Code:
on *:text:*:#firstchan: {
  if ($regex(website,$1-,(((http|ftp|irc)://)?+(([a-zA-Z]*)+\.)?+[a-zA-Z0-9_-]+\.[a-zA-Z]{2,4}(/+[a-zA-Z0-9_\./?=-]*)?))) == 1) {
    msg #newchan $regml(website,1)
  }
}


This will just message the URL and not the entire line of text

Like I said, this can probably be simplified and made better... I'm trying, tho. smile


Invision Support
#Invision on irc.irchighway.net
Re: relay script #122705 14/06/05 01:57 PM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Code:
var %x = 1, %urls , %regx = /((http|irc|ftp)://(.*?)(\040|\z))/g
while (%x <= $regex($1-,%regx)) {
  %urls = $addtok(%urls, $regml(%x),32) 
  inc %x
}
msg #newchan %urls
}

matches also if there is more then 1 link in the text.

Last edited by Mpdreamz; 14/06/05 02:06 PM.

$maybe
Re: relay script #122706 14/06/05 02:02 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Out of curiousity, does this check for links without a "type" (without having ftp:\\ or http:\\ or irc:\\)?


Invision Support
#Invision on irc.irchighway.net
Re: relay script #122707 14/06/05 02:10 PM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
no frown it also doesnt check if the domain is atleast 2 bits long. Its just a quick one i threw together imma see to that when im home :tongue:


$maybe
Re: relay script #122708 14/06/05 09:17 PM
Joined: Jan 2005
Posts: 25
L
LordoftheX Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Jan 2005
Posts: 25
RusselB

your script works fine...except it doesn't pick up anything that is just www

like www.test.com is looked over, but http://www.test.com isn't

Re: relay script #122709 28/06/05 09:48 AM
Joined: Jun 2005
Posts: 2
N
newswire Offline
Bowl of petunias
Offline
Bowl of petunias
N
Joined: Jun 2005
Posts: 2
on *:text:*:#channelname1:/msg #channelname2 $1-


this is the script you're talkin about

no bugs
works great


i use it to relay news to undernet #newswire
come visit!

Last edited by newswire; 28/06/05 09:49 AM.

-spam-