# action.create Defines a new action
Syntax
    action.define [-i] [-c] [-l] [-w=<window_types>] [-s] [-t=<category>] (<name>,<visible label>,<description>,<big_icon_id>[,<small_icon_id>])
    {
        <action body>
    }
Description
Defines a new script action. Each action has an unique <name> that must not collide with any core action (i.e. don't use the "kvirc." prefix). At any time you can check action.list to verify that no core action is already using your <name>. If the <name> was already used for a script action then this action is simply replaced by the new one. Each action has an associated <visible label> that is the name meant to be presented to the user, possibly even translated. This label will appear on the toolbar buttons, in the tooltips and in the popup menu items. The string will be evaluated just before the actions is displayed so the eventual runtime translation will fetch from the correct language catalogue. <description> is the descriptive text that will be displayed in the action choice dialog (and maybe in other places). The string will be evaluated just before the actions is displayed so the eventual runtime translation will fetch from the correct language catalogue. <big_icon_id> is the image identifier of the icon that will appear on the toolbar buttons and in the action choice dialog. <small_icon_id> is optional and is the image identifier of the icon that will appear in the menu items. Since menu items can be also iconless then this parameter is optional. <action body> is the callback code snippet that will be triggered when this action is activated either by the means of action.trigger, a toolbar button or a menu item selection. An empty <action body> causes this command to behave like action.destoy <name>.
Switches
-i
Specifies that the action needs an IRC context to be executed. When the current window does not belong to an IRC context the action is automatically disabled
-c
Specifies that the action needs an IRC connection to be executed. When the current window has no associated IRC connection the action is automatically disabled. This switch implies -i.
-l
Specifies that the action needs to be enabled at login time, that is when a link to the server has been estabilished but the login operations haven't been carried out yet (and thus there is no real IRC connection). This switch requires -c to work.
-w=<window_types>
Causes the action to be enabled only when the active window is one of the specified types. <window_types> may be any combination of the letters 'q' (query), 'c' (channel), 'x' (console), 'd' (dccchat). If this switch is omitted then the action is enabled in all the windows.
-s
Specifies that the action will be activated only if the active window has selected users in the userlist. This switch requires -w with a combination of flags 'q','c' and 'x' (it doesn't work for dcc chat).
-t=<category>
Causes the action to belong to the specified category. <category> can be one of "irc","scripting","settings","gui","channel" and "generic". If this switch is omitted the "generic" category is automatically assumed.
-k=<key sequence>
Specifies that the action will be activated also by the <key sequence> which is a string formed from up to four keyboard codes separated by commas optionally combined with the modifiers "Alt","Ctrl","Shift" and "Meta". Examples of such sequences are: "Ctrl+X", "Ctrl+Alt+F" or "Ctrl+X,Alt+Space".
Examples
See also
action.destroy, action.trigger

Index, Commands

KVIrc 3.2.0 Documentation
Generated by root at Tue Dec 4 07:16:18 2007