[Home] [Downloads] [Search] [Help/forum]

Register forum user name Search FAQ


Script function


Read about scripting




Pastes text into the command window, replacing the current selection


BSTR PasteCommand(BSTR Text);

View list of data type meanings


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.


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 ...


Commented softcode
Sending to the world


(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)

Documentation contents page

Search ...

Enter a search string to find matching documentation.

Search for:   

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]