word completer
Posted by Parasite-FT-
Saturday, May 08, 2004
Description: hit F1 to cycle through the possible matches
Simply stated, it's a word completer. Much like a nick completer (by pressing tab) you just type part of a word and hit F1 to cycle through your choices; when I think about it, it's really stupid and I'll prolly never use it unless I'm checking for an alternative spelling. Anyway, just like the tab nick completer it'll update your editbox dynamically, which is always fun.
ie,
I have this in my editbox:
then i hit F1 and it shows this in my editbox:
i hit F1 again (within 3 seconds, else the next time it'll go back to the first result):
and YAY, I have the word I was looking for after cycling through 1 other word. The pain of it is that you may have to cycle through lots of words, and that's not cool. Thankfully, to reduce the number of possible matches, I'm using a dictionary file which lists words in the order they're commonly used. This means "Hello" will appear before "Hellanistic".
You must download the dictionary file and put it in the same directory you save the script (most often just the mIRC folder.) The dictionary file can be found here: http://www.dict.org/100kfound.txt.gz - keep the file name the same after you unzip it.
Cheers, hope someone uses it.
- Para
Simply stated, it's a word completer. Much like a nick completer (by pressing tab) you just type part of a word and hit F1 to cycle through your choices; when I think about it, it's really stupid and I'll prolly never use it unless I'm checking for an alternative spelling. Anyway, just like the tab nick completer it'll update your editbox dynamically, which is always fun.
ie,
I have this in my editbox:
hello ther
then i hit F1 and it shows this in my editbox:
hello therefore
i hit F1 again (within 3 seconds, else the next time it'll go back to the first result):
hello there
and YAY, I have the word I was looking for after cycling through 1 other word. The pain of it is that you may have to cycle through lots of words, and that's not cool. Thankfully, to reduce the number of possible matches, I'm using a dictionary file which lists words in the order they're commonly used. This means "Hello" will appear before "Hellanistic".
You must download the dictionary file and put it in the same directory you save the script (most often just the mIRC folder.) The dictionary file can be found here: http://www.dict.org/100kfound.txt.gz - keep the file name the same after you unzip it.
Cheers, hope someone uses it.
- Para
;; Function: autocompletes your words, kinda neat
;; Usage: hit F1 while typing a word - hit repeatedly to get new words that might match
;; Comments: uses the dictionary file from http://www.dict.org/100kfound.txt.gz
alias F1 {
var %file = $scriptdir100kfound.txt
; increase the line number from which you should read (else it'll complete the same word each time)
inc -u3 %completer.last
; set the word that you're trying to replace - or maintain the variable for another 3 seconds
set -u3 %completer.word $iif(%completer.word,%completer.word,$gettok($editbox($active),-1,32))
; set the token number that you're trying to replace - or maintain the variable for another 3 seconds
set -u3 %completer.num $iif(%completer.num,%completer.num,$numtok($editbox($active),32))
; read the bloody file (note that each line has a number, then a tab, then the word)
var %read = $read(%file,nw,$+(*,$chr(9),%completer.word $+ *),%completer.last)
if (%read) {
; parse out the new word (get rid of tab and any multiple words)
var %newword = $gettok($gettok(%read,2,9),1,32)
; update the editbox
editbox -ap $puttok($editbox($active),%newword,%completer.num,32)
; set the last read line number
set -u5 %completer.last $readn
}
}