world.PasteCommand
Pastes text into the command window, replacing the current selection
Prototype
BSTR PasteCommand(BSTR Text);
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.
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.
Related topic
See also
| Function | Description |
|---|---|
| Accelerator | Add or modify an accelerator key (keystroke to command mapping) |
| SetCommand | Sends text to the command window |