mIRC Home    About    Download    Register    News    Help

Print Thread
#101011 19/10/04 02:24 PM
Joined: Mar 2003
Posts: 160
Marantz Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Mar 2003
Posts: 160
Ok i kinda have my own theme system going on, and want urls to be white and underlined so i can see them easier, for my input and input from other chatters, someone mentioned regex for itm but i don't quite get it i tried like if(www isin and if (http isin etc but it doesn't always work
this is what i have
Code:
  
on 1:INPUT:#:{
  if ($left($1,1) != /) { 
    haltdef
    raw -q privmsg $active : $+  $1-
    echo -24 $xnick1($me) 14:15 $1-
    halt
  }
} 
on ^1:text:*:#:{ 
  if ($me isin $strip($1-)) { echo -i24 $chan $xnick4($nick) 1414: $strip($1-) | goto arse }
  echo -i24 $chan $xnick16($nick) 00: $strip($1-)
  :arse
  if ($chan == $active) { halt } 
  if ($me isin $strip($1-)) { 
    echo -ai24 02*00Gossip02*02 14:11 $nick 15is mentioning you in10 $chan
    echo -ai24 02*00Gossip02*02 14:11 $nick 15says... $1-
    beep 
  }
  halt
}


#101012 19/10/04 06:43 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
I made this a while ago, maybe you can change it to fit your theme:

Code:
alias urlunderline { $iif($1 == on,.en,.dis) $+ able #url }

#url on
on *:input:*:{
  if (!$istok(/ $readini($mircini,text,commandchar),$left($1,1),32)) && (!$ctrlenter) {
    var %input = $1-
    .echo -q $regsub(%input,/((?:ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*)/g,\1,%input)
    .echo -q $regsub(%input,/(irc:\/\/[^<>\.\s]+(?:\.[^/<>\.\s]+)+(?:\/[^/<>\.\s]*)?\/?(?![^\s\x2c\.]))/g,\1,%input)
    .echo -q $regsub(%input,/(aim:goim\?screenname=[^\s&]+(?:&message=[^\s&=]+)?)/g,\1,%input)
    say %input
    halt
  }
}
on ^*:text:*:*:{
  var %text = $1-
  .echo -q $regsub(%text,/((?:ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*)/g,\1,%text)
  .echo -q $regsub(%text,/(irc:\/\/[^<>\.\s]+(?:\.[^/<>\.\s]+)+(?:\/[^/<>\.\s]*)?\/?(?![^\s\x2c\.]))/g,\1,%text)
  .echo -q $regsub(%text,/(aim:goim\?screenname=[^\s&]+(?:&message=[^\s&=]+)?)/g,\1,%text)
  echo -tlf $iif($chan,$chan,$iif($query($nick),$nick,$target)) $+(,$cnick($nick).color,<,$iif($gettok($readini($mircini,options,n2),30,44),$left($nick($chan,$nick).pnick,1)),$nick,>) %text
  haltdef
}
on $^*:hotlink:/aim:goim\?screenname=[^\s&]+(?:&message=[^\s&=]+)?|irc:\/\/[^<>\.\s]+(?:\.[^/<>\.\s]+)+(?:\/[^/<>\.\s]*)?\/?(?![^\s\x2c\.])/:*:{ return }
on *:hotlink:*:*:{
  if ($regex(aim,$1,/(aim:goim\?screenname=[^\s&]+(?:&message=[^\s&=]+)?)/)) { run $regml(aim,1) }
  elseif ($regex(irc,$1,/(irc:\/\/[^<>\.\s]+(?:\.[^/<>\.\s]+)+(?:\/[^/<>\.\s]*)?\/?(?![^\s\x2c\.]))/)) { run $regml(irc,1) }
}
#url end

menu menubar {
  $iif($group(#url).status == on,$style(1)) Url underlining: urlunderline $iif($group(#url).status == on,off,on)
}


New username: hixxy
#101013 20/10/04 11:31 AM
Joined: Mar 2003
Posts: 160
Marantz Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Mar 2003
Posts: 160
Nice one Tidy_Trax, just what was needed for that, it covers when text is said after and before the url is in the sentence so that doesn't get underlined. Gj thanks laugh


Link Copied to Clipboard