All pastes #752316 Raw Edit

Untitled

public text v1 · immutable
#752316 ·published 2007-10-28 08:46 UTC
rendered paste body
alias Highlight { 
  dialog -m Highlight Highlight
} 
menu * {
  Highlight:/dialog -m Highlight Highlight
}
dialog Highlight {
  title "Cracky`'s Highlight Dialog v1.4"
  size -1 -1 200 200
  option dbu
  tab "Highlight/Exception", 101, 1 1 198 198
  tab "Flash/Sound/Message", 103,
  tab "Credits", 102,
  button "On", 5, 110 30 40 12, tab 101
  button "Off", 6, 150 30 40 12, tab 101
  box "Highlight", 4, 5 20 90 55, tab 101
  button "On", 2, 10 30 40 12, tab 101
  button "Off", 3, 50 30 40 12, tab 101
  box "Exception", 7, 105 20 90 55, tab 101
  text "Exceptions allow you to ignore Highlights from selected Users.", 13, 110 45 80 15, center, tab 101
  text "Highlight allows you to highlight certain words.", 14, 10 45 80 15, center, tab 101
  button "Cancel", 9, 80 185 40 12, Cancel
  combo 10, 110 90 80 56, size, tab 101
  combo 15, 10 90 80 56, size, tab 101
  box "Add/Delete Exception", 11, 105 80 190 97, tab 101
  box "Add/Delete Highlight", 16, 5 80 90 97, tab 101
  button "Add Exception", 12, 110 149 80 12, tab 101
  button "Add Highlight", 17, 10 149 80 12, tab 101
  button "Delete Exception", 18, 110 162 80 12, tab 101
  button "Delete Highlight", 19, 10 162 80 12, tab 101
  edit "Customisable Higlight Message Here", 21, 10 30 125 12, autohs, tab 103
  box "Custom Message", 22, 5 20 190 40, tab 103
  button "Apply Message", 23, 140 30 50 12, tab 103
  text "Identifiers for Custom Message: *nick* for the name *chan* for the channel and *word* for the highighted word", 24, 5 45 190 20, center, tab 103
  edit "Status", 29, 20 60 60 10, center, read, tab 101
  edit "Status", 30, 120 60 60 10, center, read, tab 101
  box "Enable Sounds" 32, 5 65 90 40, tab 103
  button "On", 31, 10 75 40 12, tab 103
  button "Off", 33, 50 75 40 12, tab 103
  box "Enable Flash" 34, 105 65 90 40, tab 103
  button "On", 35, 110 75 40 12, tab 103
  button "Off", 36, 150 75 40 12, tab 103
  edit "Status", 37, 120 90 60 10, center, read, tab 103
  edit "Status", 38, 20 90 60 10, center, read, tab 103
  box "Echo/Msg", 45, 5 110 190 50, tab 103
  check "Echo Active", 39, 10 120 60 10, tab 103
  check "Echo Channel", 40, 10 132 60 10, tab 103
  check "Message Nick", 41, 10 144 60 10, tab 103
  edit "#Channel", 42, 110 132 80 10, tab 103
  edit "Nickname", 43, 110 144 80 10, tab 103
  button "Update Nick/Chan", 44, 110 120 80 10, tab 103
  box "Highlight Dialog v1.4", 46, 5 20 190 160, tab 102
  text "Dialog Created by Cracky`", 47, 10 40 100 10, tab 102
  box "Features", 48, 10 55 180 70, tab 102
  text "With this dialog you can add words to highlight as well as nicknames to exclude from the highlight. This dialog also enables users to customise a message that is sent when a highlight is found along with the indentifiers. The Sounds and Flash are other ways of alerting the user to the discovery of a highlight. The message can be echoed in two ways or messaged to another nick (e.g. SwiftSwitch Client) for better use.", 49, 15 70 170 60, center, tab 102
  icon 50, 163 148 40 40, E:\Robbie\icon-mirc.bmp, tab 102
}

on *:dialog:Highlight:sclick:*:{ 
  if ($did == 2) { set %highlight on | /did -o $dname 29 1 Status: ON }
  if ($did == 3) { set %highlight off | /did -o $dname 29 1 Status: OFF }
  if ($did == 5) { set %exceptions on | /did -o $dname 30 1 Status: ON }
  if ($did == 6) { set %exceptions off | /did -o $dname 30 1 Status: OFF }
  if ($did == 12) { write Exceptions.txt $did(10) | /did -a $dname 10 $did($dname,10) }
  if ($did == 17) { write Highlights.txt $did(15) | /did -a $dname 15 $did($dname,15) }
  if ($did == 18) { set %exdel $did(Highlight,10).sel | write $+(-dl,%exdel) Exceptions.txt | /did -d $dname 10 $did(Highlight,10).sel }
  if ($did == 19) { set %hidel $did(Highlight,15).sel | write $+(-dl,%hidel) Highlights.txt | /did -d $dname 15 $did(Highlight,15).sel }
  if ($did == 23) set %custommessage $did(21)
  if ($did == 35) { set %flash on | /did -o $dname 37 1 Status: ON }
  if ($did == 36) { set %flash off | /did -o $dname 37 1 Status: OFF }
  if ($did == 31) { set %beep on | /did -o $dname 38 1 Status: ON }
  if ($did == 33) { set %beep off | /did -o $dname 38 1 Status: OFF }
  if ($did == 39) { set %message //echo $active | /did -u $dname 40 | /did -u $dname 41 }
  if ($did == 40) { set %message //echo %channel | /did -u $dname 39 | /did -u $dname 41 }
  if ($did == 41) { set %message //msg %nickname | /did -u $dname 39 | /did -u $dname 40 }
  if ($did == 44) { set %nickname $did($dname,43) | set %channel $did($dname,42) }
}

on *:DIALOG:Highlight:init:0: { 
  var %y 1 
  while (%y <= $lines(Exceptions.txt)) { 
    did -a $dname 10 $read(Exceptions.txt, %y) 
    inc %y 
  } 
  var %x 1 
  while (%x <= $lines(Highlights.txt)) { 
    did -a $dname 15 $read(Highlights.txt, %x) 
    inc %x 
  } 
  if (!%custommessage) set %custommessage Highlight ( $+ *word* $+ ) found from *nick* in *chan* $+ : $1-
  if (!%highlight) set %highlight off
  if (!%exceptions) set %exceptions off
  if (!%flash) set %flash off
  if (!%message) set %message //echo $active
  if (!%channel) set %channel #Channel
  if (!%nickname) set %nickname Nickname
  if (%highlight == on) /did -o $dname 29 1 Status: ON
  if (%highlight == off) /did -o $dname 29 1 Status: OFF
  if (%exceptions == on) /did -o $dname 30 1 Status: ON
  if (%exceptions == off) /did -o $dname 30 1 Status: OFF
  if (%flash == on) /did -o $dname 37 1 Status: ON
  if (%flash == off) /did -o $dname 37 1 Status: OFF
  if (%beep == on) /did -o $dname 38 1 Status: ON
  if (%beep == off) /did -o $dname 38 1 Status: OFF
  if (%message == //echo $active) /did -c $dname 39
  elseif (*//echo #* iswm %message ) /did -c $dname 40
  if (*//msg* iswm %message) /did -c $dname 41
  if (%channel) /did -o $dname 42 1 %channel
  if (%nickname) /did -o $dname 43 1 %nickname
}

on *:TEXT:*:*: { 
  if ((%highlight == on) && (%exceptions == on)) { 
    if $read(exceptions.txt, w, $nick) { halt } 
    else { var %i = 1 
      while (%i <= $lines(highlights.txt)) { 
        if ($+(*,$read(highlights.txt, %i),*) iswm $1-) { 
          set %highlightedword $read(highlights.txt, %i) 
          %message ~~ $asctime(hh:nn:ss) ~~ $($replace(%custommessage,*nick*,$nick,*chan*,$chan,*word*,%highlightedword),2)      
          if (%flash == on) /window -g2 $chan
          if (%beep == on) /beep 5
        } 
        inc %i 
      } 
    } 
  } 
  elseif ((%higlight == on) && (%exceptions == off)) { var %i = 1 
    while (%i <= $lines(highlights.txt)) { 
      if ($+(*,$read(highlights.txt, %i),*) iswm $1-) { 
        set %highlightedword $read(highlights.txt, %i) 
        %message ~~ $asctime(hh:nn:ss) ~~ $($replace(%custommessage,*nick*,$nick,*chan*,$chan,*word*,%highlightedword),2)  
        if (%flash == on) /window -g2 $chan
        if (%beep == on) /beep 5
      } 
      inc %i 
    } 
  } 
}