Script function
world.PasteCommand
Read about scripting
Type
Method
Summary
Pastes text into the command window, replacing the current selection
Prototype
BSTR PasteCommand(BSTR Text);
View list of data type meanings
Description
This pastes the supplied text into the command window, which does not have to be empty (unlike SetCommand) at the current cursor position, replacing any selection. It returns the text that it replaced, if any.
eg.
Command window reads:
go north
^^
("go" is selected)
You execute: s = PasteCommand ("walk")
Command window now reads:
walk north
s contains "go"
You could use this to make shortcut keys that paste frequently-used words into the command window.
For example:
/Accelerator ("Alt+N", "/PasteCommand 'swordfish'")
Now, whenever you hit Alt+N the word "swordfish" is pasted into the command window, replacing the current selection, or at the cursor.
Available in MUSHclient version 3.69 onwards.
VBscript example
previous = PasteCommand ("swordfish")
Jscript example
PasteCommand ("swordfish");
PerlScript example
$world->PasteCommand ("swordfish");
Python example
PasteCommand ("swordfish")
Lua example
previous = PasteCommand ("swordfish")
Return value
The previously selected text, if any.
See Also ...
Topics
Commented softcode
Sending to the world
Functions
(Accelerator) Add or modify an accelerator key (keystroke to command mapping)
(Send) Sends a message to the MUD
(SendImmediate) Sends a message to the MUD immediately, bypassing the speedwalk queue
(SendNoEcho) Sends a message to the MUD without echoing in the output window
(SendPkt) Sends a low-level packet of data to the MUD
(SendPush) Sends a message to the MUD and saves it in the command history buffer
(SendSpecial) Sends a message to the MUD with various options
(SetCommand) Sends text to the command window
(SetCommandSelection) Selects specified columns in the command window
(Help topic: function=PasteCommand)