mIRC Home    About    Download    Register    News    Help

Print Thread
customizing TAB auto-completion #132722 13/10/05 08:30 PM
Joined: Oct 2003
Posts: 64
E
Exlax Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Oct 2003
Posts: 64
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?

Re: customizing TAB auto-completion #132723 13/10/05 08:42 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Re: customizing TAB auto-completion #132724 14/10/05 06:11 AM
Joined: Jul 2003
Posts: 655
Om3n Offline
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
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)
  }
}


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Re: customizing TAB auto-completion #132725 14/10/05 12:12 PM
Joined: Oct 2003
Posts: 64
E
Exlax Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Oct 2003
Posts: 64
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.

Re: customizing TAB auto-completion #132726 14/10/05 07:37 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
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.

Re: customizing TAB auto-completion #132727 15/10/05 02:53 AM
Joined: Jul 2003
Posts: 655
Om3n Offline
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
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.


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby