Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Is DoCommand() the proper way to call copy?
Is DoCommand() the proper way to call copy?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Kahenraz
(75 posts) Bio
|
Date
| Fri 26 Apr 2019 10:35 AM (UTC) |
Message
| Is this the proper way to call "copy" or is there a dedicated command for this? | Top |
|
Posted by
| Kahenraz
(75 posts) Bio
|
Date
| Reply #1 on Fri 26 Apr 2019 03:12 PM (UTC) |
Message
| Can we get a GetCommandSelection() for synchronous copying of a selection within the command window? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #2 on Sat 27 Apr 2019 08:29 AM (UTC) |
Message
| See GetInfo selectors 236 and 237.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 28 Apr 2019 03:05 AM (UTC) Amended on Sun 28 Apr 2019 03:06 AM (UTC) by Nick Gammon
|
Message
| Example:
<aliases>
<alias
match="copy"
enabled="y"
send_to="12"
sequence="100"
>
<send>
cmd = GetCommand()
st = GetInfo (236) -- start column
en = GetInfo (237) -- end column
if en == 0 then
selection = cmd -- no selection, take all
else
selection = cmd:sub (st, en) -- get selection
end
print ("Selection is", selection)
SetClipboard(selection) -- put on clipboard
</send>
</alias>
</aliases>
 |
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
This alias will copy the selection to the clipboard. Of course, if you run it as an alias the clipboard will then contain "copy". You can however make a macro which has "copy" in it, then you can press (say) F5 when you have text selected in the command window and the selected text will be copied. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Kahenraz
(75 posts) Bio
|
Date
| Reply #4 on Tue 30 Apr 2019 11:54 PM (UTC) |
Message
| That worked great! Thank you. | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
14,262 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top