Difference between revisions of "GM.registerMenuCommand"

From GreaseSpot Wiki
Jump to navigationJump to search
(Starting from: http://greasemonkey.mozdev.org/authoring.html)
 
m (title underscore template)
Line 1: Line 1:
{{underscore|title=GM_registerMenuCommand}}
= Syntax =
= Syntax =



Revision as of 00:09, 4 November 2006

Template:Underscore

Syntax

GM_registerMenuCommand( commandName, commandFunc, accelKey, accelModifiers, accessKey )

Description

Userscripts can call GM_registerMenuCommand to add a menu command to the "User Script Commands" submenu. The first two arguments are required; the others are optional.

commandName
Name to display in the menu
commandFunc
Function to call
accelKey
A single character (e.g. 'g') or keycode that can trigger the command
accelModifiers
A string listing modifiers that must be pressed with the accelKey. If there's more than one, then they should be separated with spaces. For example, 'shift' or 'ctrl alt'. Available modifiers are: shift, alt, meta, control, and accel.
accessKey
A single character (e.g. 'g') that can be used to jump to the command when the menu is open. It should be a letter in commandName

Examples

GM_registerMenuCommand( "Hello world!", hello, "e", "control", "h" );
GM_registerMenuCommand( "Hello world! (again)", hello2, "e", "shift alt", "w" );
GM_registerMenuCommand( "Hello world (simple)", helloSimple );