on *:text:!search *:#:{
; #### Put line limit and sourcefile here. ####
; If the sourcefile isn't located in mIRCs main directory, you have to put the complete path and filename
var %limit = 3, %file = test.txt
; filter lines that match the searchterm to 1st tempfile
filter -ffc $qt(%file) !search.temp1 * $+ $2-*
if ($filtered) {
var %matches = $v1
; chop matches to %limit lines by filtering to 2nd tempfile and get the desired output format in this file
filter -fknr $+(1-,%limit) !search.temp1 searchformat
; if the line limit was hit: add trailing line to 2nd tempfile
if (%matches > %limit) { write !search.temp2 There are %matches results for $qt($2-) $+ , output limit is: %limit $+ . Try being more correct. }
; output content of 2nd tempfile to the channel with 750ms delay per line
.play -q3m1 $chan !search.temp2 750
.remove !search.temp2
}
else { .msg $chan Found no matches for $qt($2-) $+ . }
.remove !search.temp1
}
alias -l searchformat {
tokenize 32 $1-
write $+(-l,$1) !search.temp2 $1 $+ . Found $2- in the file.
}