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

PasteCommand

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)

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.

[Home]


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 FutureQuest]