mIRC Homepage
Posted By: Exlax customizing TAB auto-completion - 13/10/05 08:30 PM
I want to make a TAB completion in a custom window. If the window's name is @window, if the editbox in the window says "win" and i press TAB, i want it to complete to say "window". ideas?
Posted By: Riamus2 Re: customizing TAB auto-completion - 13/10/05 08:42 PM
Not sure if that's possible... but you could always do something like:
Code:
on ^*:input:@:{
  if ($istok($1-,@,32)) {
    haltdef
    msg $active $reptok($1-,@,$window($active),32)
    return
  }  
}


Then, just put @ by itself wherever you want to see the window name.

Examples (@window title is @test):

Type: This @window is called @
Result: This @window is called @test

Type: @
Result: @test

Type: @ works.
Result: @test works.

Note that @ just has to be by itself (nothing touching it). so, don't put @. or @? or @! at the end of a sentence.

Not quite what you wanted, but it's something, anyhow.
Posted By: Om3n Re: customizing TAB auto-completion - 14/10/05 06:11 AM
Something like this should do the trick, untested let me know if there are problems.

/window -e @testing
Code:
on *:keydown:*:9: {
  tokenize 46 $editbox($active)
  var %last_wrd = $gettok($1-,$numtok($1-,32),32) $+ *
  if (%last_wrd iswm $active) {
    editbox -a $puttok($1-,$active,$numtok($1-,32),32)
  }
}
Posted By: Exlax Re: customizing TAB auto-completion - 14/10/05 12:12 PM
Seems to work great Om3n. Is there an identifier to return the current cursor location in the editbox. So if the cursor isn't positioned in the last word, the script will act on the word where the cursor is instead.
Posted By: DaveC Re: customizing TAB auto-completion - 14/10/05 07:37 PM
no there isnt , and also when you load the editbox the cursor ends up at the end, so if u pressed tab on a word in the middle, even if u could find where you were and change that word the cursor would move to the end frown

I thought i might mention this , i dont know how or if it would be usefll to you.
You mentioned the listbox having "win" in it and if u pressed "win<tab>" it becomes "window", well if instread the listbox had "window" in it and you type "win<tab>" whith no on key code its going to change to "window" at any location in the line, this is the default tab completion in action, just like for the channel tab completion.
Posted By: Om3n Re: customizing TAB auto-completion - 15/10/05 02:53 AM
Unfortunately this does not exist, however it was suggestion recently in the feature suggestion section so hopefully in the future smile Also, there seems to be an annoying ding sound when using the code i posted, not sure what the deal is with that.

DaveC, afaik, the built in tab auto completion wont auto-complete @window names.

Note: the code i posted could probably be improved on to auto-complete any @window name rather than just the active one.
© mIRC Discussion Forums