mIRC Home    About    Download    Register    News    Help

Print Thread
M
MauS
MauS
M
Subj.

I need to copy clicked nick in the position of the cursor

P
pheonix
pheonix
P
/clipboard $$1

M
MauS
MauS
M
That's not what i want

H
Hindsight
Hindsight
H
In the postion of the cursor?

M
MauS
MauS
M
I mean TO the position of the cursor.

For example: i set cursor to a position (in middle of text) in the editbox. Then i doubleclick a nick and my mouse nicklist action should copy that nick to the position i've set

Joined: Jan 2003
Posts: 2,973
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Jan 2003
Posts: 2,973
you can't get the cursor position. If i get what u mean you're saying say you had an edit bot:

[Some text_____]
and you put the cursor where the red bar is
[Some |text_____]
Then you want to put text in that position of the cursor..

You can't. There no $did(id).cursorpos property or anything.

N
NoScRiPtR
NoScRiPtR
N
um .. what's wrong with typing the first letter or two of the nick and hitting tab?

Joined: Dec 2002
Posts: 168
J
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 168
$did().selstart works. Using $mid, $did().selstart and $did().selend it should be easy to insert text into an editbox at the cursor position. Example:
Code:
alias inserteditbox {
  var %dname = $$1
  var %id = $$2
  var %itext = $$3-
  var %text = $did(%dname,%id)
  if ($did(%dname,%id).selstart == 0) { did -o %dname %id 1 %itext $+ %text }
  else { did -o %dname %id 1 $mid(%text,1,$did(%dname,%id).selstart) $+ %itext $+ $mid(%text,$calc($did(%dname,%id).selend + 1)) }
}

Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
Provided that we're talking about dialog editboxes. Even though I read every post in this thread, I couldn't determine that smile

Joined: Dec 2002
Posts: 168
J
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 168
True. I assumed that it was editboxes in dialogs from KingTomato's post :tongue:

For channel nicklists and editboxes I suppose you could get around the issue by using your sendkeys alias to send shift-tab (to go back to the editbox) and then sendkey the nickname. Or you could copy the nick to the clipboard and then sendkey +{TAB}^V (that way you dont have to worry about nicks containing ^{}[])
Code:
alias sendkeys var %a = sendkeys $+ $ticks | .comopen %a WScript.Shell | if !$comerr { .comclose %a $com(%a,SendKeys,3,bstr,$1-) }
alias inserteditbox {
  clipboard $$1
  ; shift tab back to the edit box, ctrl v to paste.  
  sendkeys +{TAB}^V
}
Nick List: /inserteditbox $1

Not pretty but it should work and do what the original poster wanted.

Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
That's a pretty damn good idea. You don't even need the cursor position this way.

Joined: Feb 2003
Posts: 2,737
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Feb 2003
Posts: 2,737
Except that you can't tell if you selected from the Nicklist side-listbox popup, or from the Nicklist nick-appearing-in-channel popup. If you Shift+Tab when clicking a nick in the channel, you'll end up in the side-listbox.

- Raccoon


Link Copied to Clipboard