Is this the proper way to call "copy" or is there a dedicated command for this?
Is DoCommand() the proper way to call copy?
Posted by Kahenraz on Fri 26 Apr 2019 10:35 AM — 5 posts, 20,071 views.
Can we get a GetCommandSelection() for synchronous copying of a selection within the command window?
See GetInfo selectors 236 and 237.
GetInfo
The documentation for the GetInfo script function is available online. It is also in the MUSHclient help file.
Example:
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.
<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.
That worked great! Thank you.