I am looking for a script to replace the entered nickname
Added by Charlie Sorrow over 4 years ago
I am looking for a script which, after entering the nick in the text input field, will return it in the form:
nick!ident@host
Replies (20)
RE: I am looking for a script to replace the entered nickname - Added by Paul Janson over 4 years ago
//var %a $input(label,e) | var %b $address(%a,5) | echo -a %b | return %b
RE: I am looking for a script to replace the entered nickname - Added by Charlie Sorrow over 4 years ago
It doesn't work. I enter the first letters of the nickname, press the Tab key and the full nickname appears to me.
RE: I am looking for a script to replace the entered nickname - Added by Charlie Sorrow over 4 years ago
What am I doing wrong? How should I use this script to make it work?
RE: I am looking for a script to replace the entered nickname - Added by Paul Janson over 4 years ago
You asked for a script, however then you report the tab-complete behavior from pressing the <tab> key while the cursor touches a letter that's in the editbox. The code they gave works. If you paste that command into the editbox, it pops open a dialog where you can type the nick. After the input box closes, the script shows the full nick!userid@hostname string which matches the nick, assuming they're in your internal address list, which might not always be true if the nick was already in channel before you joined and that nick hasn't done anything since. To ensure all nicks are in your IAL, you can issue the command: /who #channelname This is the same command, wrapped inside an alias. If you issue the command: /nick2address it displays the address to the active window. The RETURN command returns the result to a script if it's called as an identifier like $nick2address alias nick2address //var %a $input(label,e) | var %b $address(%a,5) | echo -a %b | return %b
RE: I am looking for a script to replace the entered nickname - Added by Charlie Sorrow over 4 years ago
Now I understand & it works.
But I'm looking for something that works by typing the command/alias and nickname, and the nickname!ident@host will be returned directly to the text input field.
e.g.:
/alias nick
will be changed to:
nick!ident@host
RE: I am looking for a script to replace the entered nickname - Added by Mr. Matt about 4 years ago
Oh well, it's a bit late, maybe someone else will find it usefull. By the way, if I understand what you want this should works:
alias n2a { editbox $iif($address($1,5),$v1,$1) }
Then just type in editbox: /n2a NICKNAME
RE: I am looking for a script to replace the entered nickname - Added by Charlie Sorrow about 4 years ago
@Mr.Matt, where should I paste this code? In aliases or in scripts?
RE: I am looking for a script to replace the entered nickname - Added by Mr. Matt about 4 years ago
@Charlie Sorrow: paste it in scripts. ALT + R to open it.
RE: I am looking for a script to replace the entered nickname - Added by Charlie Sorrow about 4 years ago
@Mr.Matt: works excellent. Thank You!
RE: I am looking for a script to replace the entered nickname - Added by Charlie Sorrow about 4 years ago
@Mr. Matt: I have one more question. How can I modify your script to run after pressing the Spacebar after the nickname instead of the Enter key?
RE: I am looking for a script to replace the entered nickname - Added by Mr. Matt about 4 years ago
Ok! This will be a little more tricky.
You have to use the spacebar key to trigger the script, since it's very likely you will press the spacebar multiple times while typing, the script will trigger a lot of times. So I think it's better to user another event, like the TAB key.
So I was thinking something like this, write the nick and then press the TAB key. Alternatively you can write part of the nick and complete it with TAB, then press the TAB key again to trasform it into the adress.
So, try putting this on scripts (ALT + R):
on 1:tabcomp:#:{
n2a.tab $target $n2a($gettok($editbox(#),$n2a.token(#),32))
}
alias n2a { return $iif($address($1,5),$v1,$1) }
alias -l n2a.tab { editbox $puttok($editbox($1),$2,$n2a.token($1),32) }
alias -l n2a.token { return $numtok($left($editbox($1),$editbox($1).selstart),32) }
I was trying to keep the other text, so you should be able to write on your editbox something like "Text text text NICKANME" and then press TAB, the output will be "Text text text NICK@ADDRESS".
I hope this is what you are looking for.
~Cheers
RE: I am looking for a script to replace the entered nickname - Added by Charlie Sorrow about 4 years ago
@Mr. Matt: Works amazing! Thank You again!
RE: I am looking for a script to replace the entered nickname - Added by Charlie Sorrow about 4 years ago
@Mr. Matt: unfortunately today I ran into a problem using your script.
The problem concerns two nicknames: Matthew and Matthias.
To distinguish between these nicks, you must type as many as 6 letters before pressing the Tab key. Because if we just type 'mat' and hit the Tab key twice, Matthias's ident and host will be added to Matthew's nickname.
Is it possible to modify the script so that for these two nicks it looks like this?
1. We write 'mat'.
2. Press the Tab key.
3. Matthew's nickname is displayed.
4. Press the Tab key.
5. Matthew!MatthewIdent@MatthewHost displays.
6. Press the Tab key.
7. The nickname Matthias is displayed.
8. Press the Tab key.
9. Matthias!MatthiasIdent@MatthiasHost is displayed
Alternatively, I would ask you to rewrite the script for the keyboard shortcut: AltGr + Tab instead of the Tab key itself.
RE: I am looking for a script to replace the entered nickname - Added by Charlie Sorrow about 4 years ago
Any ideas?
RE: I am looking for a script to replace the entered nickname - Added by Mr. Matt about 4 years ago
Ok, sorry for the delay. This will be A LOT more tricky.
I think I can't use the alt+tab or altgr+tab thing, because it's used to switch to any running program in Windows.
So I used an old script to menage the tabcomp with a custom window.
Well, press ALT+R and remove the previous script and change with this one:
;-- tabcontrol nick 2 address
menu @nicks {
lbclick:tab.comp $sline(@nicks,1).ln
dclick:tab.close
}
on 1:tabcomp:#:{
var %:chan = $chan
if ($gettok($1-,$tab.tok,32) ison %:chan) {
window -dhkln +t @Nicks $calc($window(%:chan).dx +1) $calc(($window(%:chan).dy + $window(%:chan).dh) -38) 250 100
var %:x = 1
while ($nick(%:chan,%:x)) {
var %:n = $v1, %:m = $+($gettok($tab.line,$tab.tok,32),*)
if ((%:m iswm $remove(%:n,`,^,-,_,[,],$chr(123),$chr(125),|,\)) || (%:m iswm %:n)) {
var %i = $remove($ifmatch,*), %p = $pos(%:n,%i,1), %c = $iif($gettok($tab.line,$tab.tok,32) == *,%:n,$+($left(%:n,$calc(%p - 1)),04,$mid(%:n,%p,$len(%i)),,$mid(%:n,$calc(%p + $len(%i))))), %y = 1
while ($nick(%:chan,%:n).idle >= $nick(%:chan,$strip($line(@nicks,%y))).idle) inc %y 1
iline @nicks %y %c
}
inc %:x 1
}
titlebar @nicks $line(@nicks,0)
tab.comp 1
if ($line(@nicks,0) > 1) window -a @nicks
else tab.close
halt
}
}
on *:keydown:@nicks:*:{
var %k = $keyval
if (%k == 9) {
var %l = $sline(@nicks,1).ln, %:n = $iif($line(@nicks,0) == %l,1,$calc(%l + 1))
tab.comp %:n
}
elseif ((%k == 8) || (%k == 27)) tab.highlight
elseif (%k == 13) return
elseif ($keychar) {
if ((%k == 186) || (%k == 188) || (%k == 190) || (%k == 191) || (%k == 222)) var %:n = $keychar
var %p = $calc($len($gettok($tab.line,$+(1-,$tab.tok),32)) + 3)
editbox $+(-b,%p,e,%p,$iif(%k == 32,p)) $tab.win $iif(%:n,$puttok($tab.line,$+($gettok($tab.line,$tab.tok,32),%:n),$tab.tok,32),$instok($tab.line,$keychar,$calc($tab.tok + 1),32))
tab.close
}
}
on *:active:*:if (($window(@nicks)) && ($active != @nicks)) tab.close
on *:close:@nicks:tab.highlight
alias -l tab.tok return $numtok($left($tab.line,$editbox($tab.win).selstart),32)
alias -l tab.win return $iif($active == @nicks,$lactive,$v1)
alias -l tab.line return $editbox($tab.win)
alias -l tab.close window -c @nicks
alias -l tab.comp {
sline @nicks $1
var %p = $calc($len($gettok($tab.line,$+(1-,$calc($tab.tok - 1)),32)) + $len($line(@nicks,$1)))
editbox $+(-b,%p,e,%p) $tab.win $puttok($tab.line,$n2a($strip($line(@nicks,$1))),$tab.tok,32)
}
alias -l tab.highlight {
var %l = $tab.line, %t = $tab.tok
editbox $+(-b,$calc(($len($gettok(%l,$+(1-,%t),32)) - $len($gettok(%l,%t,32))) + 1),e,$calc($len($gettok(%l,$+(1-,%t),32)) + 1))) $tab.win %l
tab.close
}
alias n2a {
return $iif($address($1,5),$v1,$1)
}
Just click on the nickname on the list or keep pressing tab
You should get something like this:
Senzanome.png (9.53 KB) Senzanome.png | yabcomp |
RE: I am looking for a script to replace the entered nickname - Added by Charlie Sorrow about 4 years ago
@Mr. Matt:
Unfortunately, your script doesn't work correct for me. Its only effect is adding '04' to the nickname.
Anyway, in my previous post I expressed myself a bit badly. The Alt+Tab keyboard shortcut in Windows is actually used to switch windows between running applications. But I didn't mean to assign the Alt+Tab shortcut to the script, only Alt+Ctrl+Tab. On my keyboard, the AltGr key corresponds to the Alt+Ctrl key combination. So, if you can, assign the Alt+Ctrl+Tab keyboard shortcut to your PREVIOUS script which was the best.
Sorry for the lack of precision and the confusion it caused!
RE: I am looking for a script to replace the entered nickname - Added by Mr. Matt about 4 years ago
Oh that's strange, it's working for me.
By the way let's keep it simple. Maybe it's better to use a F-key (like F1). So you can press TAB to change nicks without problem and then press F1 to get the address.
Use only this code and remove the previous one. (Paste it in scripts ALT+R)
alias F1 { n2a.tab $target $n2a($gettok($editbox(#),$n2a.token(#),32)) }
alias n2a { return $iif($address($1,5),$v1,$1) }
alias -l n2a.tab { editbox $puttok($editbox($1),$2,$n2a.token($1),32) }
alias -l n2a.token { return $numtok($left($editbox($1),$editbox($1).selstart),32) }
If you don't like F1, just change it to the number you like.
RE: I am looking for a script to replace the entered nickname - Added by Charlie Sorrow about 4 years ago
@Mr. Matt:
With the F1 key your script works great.
Could you please just explain to me how to assign a key combination for this script? For example, Ctrl+F1 or Alt+Ctrl+F1.
RE: I am looking for a script to replace the entered nickname - Added by Mr. Matt almost 4 years ago
Just replace F1 (it's in the first line) with:
sF1 if you want shift+F1
cF1 for control+F1
csF1 for control+shift+F1
aF1 for alt+F1
asF1 for alt+shift+F1
RE: I am looking for a script to replace the entered nickname - Added by Charlie Sorrow almost 4 years ago
@Mr. Matt:
This is exactly what I needed! Thanks again for your help and patience!