WoW:API RunBinding: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
m (Move page script moved page API RunBinding to API RunBinding without leaving a redirect)
 
(5 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{API/Uncategorized}}
{{wowapi}}
 
<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
Executes a key binding as if a key was pressed.
 
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
RunBinding("command" {,"up"});
 
=== Arguments ===
<!-- List each argument, together with its type -->
:("command" [,"up"])
 
:;command : String - Name of the key binding to be executed
:;up : String - The string literal "up". If specified, the binding is run as if the key was released.
 
== Example ==
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
RunBinding("TOGGLEFPS");
 
Toggles the display of the FPS counter, as if CTRL+R was pressed.
 
==Details==
<!-- Details not appropriate for the main description can go here -->
 
The "command" argument must match one of the (usually capitalized) binding names in a Bindings.xml file. This can be a name that appears in the Blizzard FrameXML Bindings.xml, or one that is specified in an AddOn.
 
RunBinding cannot be used to call a [[:Category:World of Warcraft API/Protected Functions|Protected Function]] from an unsigned addon.
 
By default, the key binding is executed as if the key was pressed down, in other words the keystate variable will have value "down" during the binding's execution. By specifying the optional second argument (the actual string "up"), the binding is instead executed as if the key was released, in other words the keystate variable will have value "up" during the binding's execution.
 
----
__NOTOC__

Latest revision as of 04:47, 15 August 2023

WoW API < RunBinding

Executes a key binding as if a key was pressed.

RunBinding("command" {,"up"});

Arguments[edit]

("command" [,"up"])
command
String - Name of the key binding to be executed
up
String - The string literal "up". If specified, the binding is run as if the key was released.

Example[edit]

RunBinding("TOGGLEFPS");

Toggles the display of the FPS counter, as if CTRL+R was pressed.

Details[edit]

The "command" argument must match one of the (usually capitalized) binding names in a Bindings.xml file. This can be a name that appears in the Blizzard FrameXML Bindings.xml, or one that is specified in an AddOn.

RunBinding cannot be used to call a Protected Function from an unsigned addon.

By default, the key binding is executed as if the key was pressed down, in other words the keystate variable will have value "down" during the binding's execution. By specifying the optional second argument (the actual string "up"), the binding is instead executed as if the key was released, in other words the keystate variable will have value "up" during the binding's execution.