Top

Auto script-file text locator


mIRC Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  0.0 (of 0 scores)
Date Added  Nov 17, 2009
Last Updated  Nov 17, 2009

Description

This code searches all loaded *.mrc files for the search string.
If the search string is found, each occurrence of the search string,
along with the file name and line number, is displayed in a custom window.

Furthermore, double-clicking a line in the custom window will automatically
open the corresponding script file and place the cursor at the beginning of
the line containing the search term.

I also use similar code to list every occurrence of an alias, which I find
particularly useful in debugging.

I hope it works OK for others.


Grab the Code

; Usage : /searchfor sometext
; and double-click an item in the resulting window
alias searchfor {
  window -l -t30 @search | clear @search
  %scripts = $script(0)
  %searchTerm = $$1-
  while %scripts {
    filter -fkn $script(%scripts) extract *
    dec %scripts
  }
}
 
on *:close:@search: {
  unset %scripts
  unset %searchterm
}
 
alias extract {
  if %searchterm isin $1- {
    aline @search  4 $+ $script(%scripts)12 $chr(9) $+ 12 $+ $1-
  }
}
menu @search {
  dclick: {
    var %selected = $line(@search,$1,1)
    tokenize 32 %selected
    var %scriptFile = $strip($1)
    var %scriptline = $strip($2)
    var %nopath = $nopath(%scriptfile)
    clipboard %nopath
    showmirc -s 
    sendkeys % $+ r $+ % $+ r $+ ^ $+ m $+ ^ $+ v $+ {enter}
    timer -m 1 500 /gotoLine %scriptLine
  }
}
 
alias -l gotoLine {
  clipboard $1
  sendkeys ^ $+ g $+ ^ $+ v $+ {enter}
}
 
 
alias -l sendkeys {
  var %object = sendkeys $+ $ticks
  .comopen %object WScript.Shell
  if ($com(%object)) { .comclose %object $com(%object,SendKeys,3,bstr,$1-) }
}
 
 

Comments

  (3)  RSS
p0tat3rs
Comments: 7
 
mIRC Snippet:  Auto script-file text locator
Posted on Nov 18, 2009 1:53 am
It wouldn't hurt to have the script search through *.ini files as well... as some users tend to save their scripts with that extension. I'm a tad too lazy to look at the actual functionality of the code, but as far as looking clean goes: not too bad, though I'd advise against use of "|".
Cracker200
Comments: 273
 
mIRC Snippet:  Auto script-file text locator
Posted on Nov 18, 2009 12:19 pm
^
Cracker200
Comments: 273
 
mIRC Snippet:  Auto script-file text locator
Posted on Nov 18, 2009 12:19 pm
and /me pee's on p0tat3rs
:D

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  

Bottom