mIRC Chm Help Enhancer — File Browser

mIRCChmHelpEnhancerv0.3 / mIRCChmHelpEnhancerv0.3 / mircchm.mrc

mircchm.mrc — 6.09 KB — Download this file

;--------------
; mIRC Chm Help Enhancer Script by Adrenalin from Moldova
; adrenalinup+mirc@gmail.com
; http://www.asachi.com/mirc_chm/
;----------------
; Date: 25/10/2004
; Version: 0.3
;----------------
; PURPOSE:
; Allow you get desired topic using command line
; It also imitate the Help->Search window
;
; SYNTAX:
; /help <keyword>
; example /help $asc
;
; NOTES:
; By typing just /help you'll get the Help Topics in a custom 
; dialog window like Help->Search one(the difference is what by 
; clicking a topic you'll get it in the .chm anchored version)..
; You can enable/disable hotkey F1 for fast access to that Search Window
; /enable #chm.f1 or /disable #chm.f1
;
; If you find some errors in script or help file, please email me.
;--------------------------


#chm.f1 on
Alias f1 /help
#chm.f1 end

on *:LOAD:{
  linesep
  echo -s 1. mIRC Chm Help 6.16 scripts loading..
  var %out = 2. Checking for mircchm.db..
  if ($isfile($+(",$scriptdir,mircchm.db,"))) echo -s %out 3OK 
  else { echo %out Fatal 4ERROR! Can't find $+($scriptdir,mircchm.db) ! | goto err }

  var %out = 3. Checking for mircchm.chm..
  if ($isfile($+(",$scriptdir,mirc.chm,"))) echo -s %out  3OK 
  else { echo -s %out Can't find $+($scriptdir,mirc.chm) ! Fattal 4ERROR!  | goto err }
  echo Script and anchored help file is READY for ussing!
  echo Writed by Adrenalin from Moldova.
  linesep
  echo You can press F1 or type 12/help to get Help Topics(like Help->Search specially for .chm)
  echo Or 12/help 3$asc to get the $ $+ asc identifier topic..
  echo Incorrect /help 4key will open Help Topics with the key writed there..
  echo Enjoy :)

  linesep
  return
  :err
  echo -s 4FATAL ERROR! PLease make sure what mircchm.db,mircchm.chm,mircchm.mrc are in $scriptdir !
}

on *:UNLOAD:{
  linesep
  echo Clean the temp chm variables.. 3DONE!
  unset chm.*
  echo Thanks for ussing mIRC Chm Help.
  linesep
}
alias -l chm.db {
  var %p = $+(",$scriptdir,mircchm.db,")
  if (!$isfile(%p)) { echo 4ERROR! Can't load %p | halt }
  return %p
}

alias chm.nThtm {
  if ($fopen(htms)) .fclose htms 
  .fopen htms $chm.db()

  if ($1 !isnum) {
    if (!$regex($1-,/(\d+)#(.+)/)) { goto err }
    else tokenize 32 $regml(1) $regml(2) 
  }
  var %n = 0, %w

  while (!$feof) {
    var %char = $fgetc(htms)
    if (%char == 13) goto err
    if (%char == 9) {
      inc %n
      if (%n > $1) { goto re }
    }
    else { 
      if (%n == $1) { var %w = %w $+ $chr(%char) }
    }
  }
  :err
  .fclose htms
  return 0
  :re
  .fclose htms
  return html/ $+ %w $+ .htm $+ $iif($2, $chr(35) $+ $ifmatch)
}

Alias help {
  if ($1- == $null) { dialog -m chm.show_topics $+ $ticks chm.show_topics | return }
  var %db = $chm.db(), %loca, %loc

  var %chm = $scriptdir $+ mirc.chm
  if (!$isfile(%chm)) { echo 4ERROR! Can't open %chm | return }
  if ($1 == -x) { var %loca = $2- | goto x }

  var %key = $1-

  if ($read(%db, wn, %key $+ :*)) {
    var %loca = $gettok($ifmatch,2-,58)
    if ("@" isin %loca) {
      var %name = chm.tfounds. $+ $ticks
      set % $+ [ %name ] %loca
      dialog -m chm.tfounds. $+ %name chm.tfounds
      return
    } 
    else {
      tokenize 35 %loca
      :x
      var %loc = $chm.nThtm(%loca)
      run hh.exe mk:@MSITStore: $+ %chm $+ :: $+ %loc
      return
    }
  }
  else {
    var %t = chm.show_topics $+ $ticks
    dialog -m %t chm.show_topics
    did -a %t 1 $1-
    var %k = $1-
    while ($len(%k) != 0) {
      if ($didwm(%t, 2 , %k $+ *,1)) break
      var %k = $left(%k, -1)
    }
    did -c %t 2 $didwm(%t, 2 , %k $+ *,1)
  }
}

;custom dialog for Multiple Locations

dialog chm.tfounds {
  title "Topic Found"
  size -1 -1 233 103
  option dbu
  list 2, 5 23 221 61, size
  text "Click a &topic, then click Dispaly.", 1, 5 5 76 8
  button "Title                                                                                                                                      ", 3, 6 15 219 9, flat
  button "Display", 4, 151 89 37 12, ok
  button "Cancel", 5, 192 89 37 12, cancel
}

on *:DIALOG:chm.tfounds*:*:*:{
  if ($devent == init) {
    var %regmatch = "(.*?)"@"(.*?)" "(.*?)"@"(.*?)"
    var %v = [ % $+ [ $gettok($dname,3-,46) ] ]
    var %temp = $regex(%v, %regmatch)
    did -a $dname 2 $regml(1)
    did -a $dname 2 $regml(3)
    did -c $dname 2 1
  }
  if (($did == 0) && ($devent == close)) unset % $+ [ $gettok($dname,3-,46) ]
  if (($did == 2) && ($devent == dclick)) {
    dialog -k $dname
  }
  if (($did == 3) && ($devent == sclick)) { did -f $dname 2 }
  if (($did == 4) && ($devent == sclick)) {
    did -f $dname 2

    var %regmatch = "(.*?)"@"(.*?)" "(.*?)"@"(.*?)"
    if ($regex([ % $+ [ $gettok($dname,3-,46) ] ], %regmatch)) help -x $regml($calc($did(2).sel * 2))
    unset % $+ [ $gettok($dname,3-,46) ]

  }
}

;Custom Dialog for Show Index List
dialog chm.show_topics {
  title "Help Topics: mIRC Chm Help"
  size -1 -1 213 200
  option dbu
  edit "", 1, 16 35 167 11, tab 5
  tab "Index", 5, 3 1 206 181
  list 2, 15 57 168 114, tab 5 size
  text "1  Type the first few letters of the word you're looking for.", 3, 12 24 146 10, tab 5
  text "2  Click the index entry you want, and then click Display.", 6, 11 48 138 8, tab 5
  button "Display", 4, 84 186 37 12, ok
  button "Print", 7, 126 186 37 12, disable
  button "Cancel", 8, 166 186 37 12, cancel
}

Alias -l chm.add.topics {
  did -a %chm.temp.ditopic 2 $gettok($1-,1,58)
}

on *:dialog:chm.show_topics*:*:*:{
  if ($devent == init) {
    set %chm.temp.ditopic $dname
    filter -fk $chm.db chm.add.topics *:*
    unset %chm.temp.ditopic
    did -c $dname 2 1
  }
  if (($did == 4) && ($devent == sclick)) {
    var %key = $did($dname, 2, $did($dname,2).sel)
    help %key
  }
  if (($did == 1) && ($devent == edit)) {
    var %t = $did($dname,1)
    did -c $dname 2 $didwm($dname, 2 , %t $+ *,1)
  }

  if (($did == 2) && ($devent == sclick)) {
    did -ar $dname 1 $did($dname, 2, $did($dname,2).sel)
  }
  if (($did == 2) && ($devent == dclick)) {
    dialog -k $dname
  }
}