GM.registerMenuCommand

From GreaseSpot Wiki
Revision as of 03:33, 6 December 2006 by LouCypher (talk | contribs) (categorized)
Jump to navigationJump to search

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