Better Highlight

By smilinbob on Jul 11, 2010

Screenshots

This is a bit of code I wrote to replace mirc's default highlighting. Instead of highlighting the entire line that matches, it only highlights the word(or words) that contain the highlighted text. Multiple highlight words may be set with their own colors.

It also optionally outputs the matching line to a custom window with the Network, Channel and Nick. Now you don't have to scroll back through hours of logs to find out what triggered your highlight.
To enable the pop-up window, simply un-comment the 2 lines before "halt" at the bottom of the script.

The script is controlled with the /BHL command.
Comands:
/bhl list : Lists all current highlights in their own colors
/bhl add : Adds a highlight to the end of the list using text prompts
/bhl delete N : Deletes the Nth highlight
/bhl edit N : Edits the Nth highlight
/bhl clear : Clears all highlights
/bhl help : Displays the command list

Changes:
Dual color codes now work
Added /bhl clear command in case you mess up the highlights

alias bhlt {
  if ($prop == n) {
    return $calc($numtok(%bhls,131) / 2)
  }
  if ($prop == t) {
    return $gettok(%bhls,$calc(($1 * 2) -1),131)
  }
  if ($prop == c) {
    return $gettok(%bhls,$calc($1 * 2),131)
  }
}
alias bhl {
  if ($1 == list) {
    var %h = 1
    while (%h <= $bhlt().n) {
      var %hlist = %hlist %h $+ :  $+ $bhlt(%h).c  $bhlt(%h).t  
      inc %h
    }
    echo Highlights: %hlist
  }
  elseif ($1 == edit) {
    var %new = $puttok(%bhls,$$?="Highlight Word $$2",$calc(($$2 * 2) - 1),131)
    var %new = $puttok(%new,$$?="Highlight Color $$2 $crlf $+ Format NN or NN $+ $chr(44) $+ NN $crlf  ie. 07 or 12 $+ $chr(44) $+ 03",$calc($$2 * 2),131)
    set %bhls %new
    .timer 1 1 bhl list
  }
  elseif ($1 == delete) {
    var %new = $deltok(%bhls,$calc(($$2 * 2) - 1) $+ - $+ $calc($$2 * 2),131)
    set %bhls %new
    .timer 1 1 bhl list
  }
  elseif ($1 == add) {
    var %w = $$?="New Highlight Word:"
    var %c = $$?="New Highlight Color $crlf $+ Format NN or NN $+ $chr(44) $+ NN $crlf  ie. 07 or 12,03"
    set %bhls %bhls $+ $chr(131) $+ %w $+ $chr(131) $+ %c
    .timer 1 1 bhl list
  }
  elseif ($1 == clear) {
    unset %bhls
  }
  elseif ($1 == help || $1 == $null) {
    echo Comands:
    echo 4/bhl list : Lists all current highlights in their own  colors
    echo 4/bhl add : Adds a highlight to the end of the list using text prompts
    echo 4/bhl delete N : Deletes the Nth highlight
    echo 4/bhl edit N : Edits the Nth highlight
    echo 4/bhl clear : Clears all highlights
    echo 4/bhl help : Displays this command list
  }
}
on ^*:TEXT:*:#: {
 if (%bhls) {
   var %hn = 1
   var %h = $1-
   while (%hn <= $bhlt().n) {
     if ($bhlt(%hn).t isin %h) {
       var %hd = 1
       var %hl = $eval(* $+ $v1 $+ *)
       var %hh = 1
       while (%hh <= $wildtok(%h,%hl,0,32)) {
         var %h = $reptok(%h,$wildtok(%h,%hl,%hh,32),$+  $+ $bhlt(%hn).c $+ $wildtok(%h,%hl,%hh,32) $+ ,1,32)
         inc %hh 
       }   
     }
     inc %hn
   }
   if (%hd == 1) {
     echo -t $chan $chr(60) $+ $nick $+ $chr(62) %h
     beep
     ;window -k0 @HIGHLIGHT 
     ;echo -t @HIGHLIGHT $chr(123) $+ $network $+ $chr(125) $chr(91) $+ $chan $+ $chr(93) $chr(60) $+ $nick $+ $chr(62) %h
     halt
   }
 }
}

Comments

Sign in to comment.
Jamiie   -  Jul 20, 2010

H0LLYWOOD, I have a Highlight script that logs all highlights and can be viewed from a window.

http://www.hawkee.com/snippet/4504/

 Respond  
H0LLYWOOD   -  Jul 12, 2010

can you make the @Highlight window within the mIRC Client, and not on the taskbar please?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.