KeyBind Help File

KeyBind Help File

Plugin Name:

KeyBind

Current Version:

1.0.0.0

Description:

This plugin makes key binding, key code association and integrated script execution simple. No more memorizing key codes or endless lines of code on differnent pages or seperate objects. With KeyBind, creating key-script assoaciations is simple and quick.

Licence:

GNU GPL v3

Author:

Centauri Soldier

Web:

www.AMSPublic.com

E-mail:

CentauriSoldier@AMSPublic.com

Requirements:

AutoPlay Media Studio 8 or higher.

Copyright:

Copyright © 2010 AMSPublic.com

Install Notes:

Place the KeyBind folder in your "AutoPlay Media Studio\Plugins\Action" folder.


Table of Contents

KeyBind.BindGroup
KeyBind.BindKey
KeyBind.DeleteKeyBinding
KeyBind.DeleteKeyTable
KeyBind.GetKey
KeyBind.GetKeyCode
KeyBind.GetKeyCount
KeyBind.GetKeyName
KeyBind.GetKeyTableCount
KeyBind.GetKeyTableNames
KeyBind.KeyIsBound
KeyBind.KeyTableDoesExist
KeyBind.LoadSettings
KeyBind.OnKey
KeyBind.SaveSettings
KeyBind.SetKeyAtt
KeyBind.UpdateGrid

KeyBind.BindGroup


(number) KeyBind.BindGroup ( 

(table) Source Table = tKeys,

(string) Key Table )

Description

Binds a group of specified keys at once.

Parameters

Source Table

(table) The numerically-indexed table containing subtables with each of the keys and their properties.

Note: See KeyBind.BindKey() for specifics on how to create a single key binding.

Key Table

(string) The name of the key table upon which this action will be executed.

Note: Set this to "" or nil to use the default key table.

Returns

(number)
-1 : The specified key is not supported or does not exist
0 : Action was successful


Example

local tKeys = {
{Text="Test Key 1",Description="Here's some text",Key=KeyBind.Key.Tab,Shift=false,Ctrl=true,Alt=false,Script=[[
Dialog.Message("Key Test", "This is a test of the \"Ctrl + "..KeyBind.GetKeyName(KeyBind.Key.Tab).."\" key combination");


--test of multiline
]]},
{Key=KeyBind.Key.l,Script=[[Dialog.Message("Test Key", "This is the l key");]]}
};

KeyBind.BindGroup(tKeys);



KeyBind.BindKey


(number) KeyBind.BindKey ( 

(number) Key = KeyBind.Key.Enter,

(string) Text = "Clear Mines",

(string) Description = "Used by engineers to clear mines from a battlefield",

(boolean) Shift = false,

(boolean) Ctrl = false,

(boolean) Alt = false,

(string) Script = "Dialog.Message(\"Key Test\", \"Hello World\");",

(string) Key Table )

Description

Binds a single key.

Parameters

Key

(number) The key code number of the key that will be bound.

Text

(string) This is a short description of the key's action.

Note: Not required.

Description

(string) This is the long description of the key's action.

Note: Not required.

Shift

(boolean) Requires the Shift modifier.

Note: Not required. This is false by default.

Ctrl

(boolean) Requires the Ctrl modifier.

Note: Not required. This is false by default.

Alt

(boolean) Requireds the Alt modifier.

Note: Not required. This is false by default.

Script

(string) The script that will be executed when the key (or key combination) is pressed.

Note: Not required but recommended.

Key Table

(string) The name of the key table upon which this action will be executed.

Note: Set this to "" or nil to use the default key table.

Returns

(number)
-1 : The specified key is not supported or does not exist
0 : Action was successful


Example

local sCode = "Dialog.Message(\"Success\", \"Mine Cleared\");"
KeyBind.BindKey(KeyBind.Key.M, "Clear Mines", "This ability is used by engineers to clear mines from the battlefield", false, false, false, sCode);



KeyBind.DeleteKeyBinding


(number) KeyBind.DeleteKeyBinding ( 

(number) Key = KeyBind.Key.r,

(string) Key Table )

Description

Deletes a key binding from a key table.

Parameters

Key

(number) The key code number of the key that will be deleted.

Key Table

(string) The name of the key table upon which the action will be executed.

Note: Set this to "" or nil to use the default key table.

Returns

(number)
-3 : The specified key is unbound
-2 : The specified key table does not exist or is empty
-1 : The specified key is not supported or does not exist
0 : Action was successful


KeyBind.DeleteKeyTable


(number) KeyBind.DeleteKeyTable ( 

(string) Key Table = "Input Key Bindings" )

Description

Deletes an entire set of keys and their key table at once.

Parameters

Key Table

(string) The name of the key table to delete.

Returns

(number)
-2 : The specified key table does not exist or is empty
0 : Action was successful


KeyBind.GetKey


(table) KeyBind.GetKey ( 

(number) Key = KeyBind.Key.Four,

(string) Key Table )

Description

Gets the properties of the specified key.

Parameters

Key

(number) The key code number of the key whose attributes are being requested.

Key Table

(string) The name of the key table upon which this action will be executed.

Note: Set this to "" or nil to use the default key table.

Returns

(table)
-3 : The specified key is unbound
-1 : The specified key is not supported or does not exist

When the action is successful, a table is returned which contains the key's attributes. The table is indexed by the following.
Key
Name
Text
Desc
Shift
Ctrl
Alt
Script


KeyBind.GetKeyCode


(number) KeyBind.GetKeyCode ( 

(string) Key Name = "Enter" )

Description

Gets the key code given the key name.

Parameters

Key Name

(string) The name of the key whose code is being requested.

CONSTANT

VALUE

DESCRIPTION

"LeftMouseButton"

NA

NA

"RightMouseButton"

NA

NA

"MiddleMouseButton"

NA

NA

"Backspace"

NA

NA

"Tab"

NA

NA

"Enter"

NA

NA

"Shift"

NA

NA

"Ctrl"

NA

NA

"Alt"

NA

NA

"Pause"

NA

NA

"CapsLock"

NA

NA

"Esc"

NA

NA

"Spacebar"

NA

NA

"PageUp"

NA

NA

"PageDown"

NA

NA

"End"

NA

NA

"Home"

NA

NA

"Left"

NA

NA

"Up"

NA

NA

"Right"

NA

NA

"Down"

NA

NA

"Insert"

NA

NA

"Delete"

NA

NA

"0"

NA

NA

"1"

NA

NA

"2"

NA

NA

"3"

NA

NA

"4"

NA

NA

"5"

NA

NA

"6"

NA

NA

"7"

NA

NA

"8"

NA

NA

"9"

NA

NA

"A"

NA

NA

"B"

NA

NA

"C"

NA

NA

"D"

NA

NA

"E"

NA

NA

"F"

NA

NA

"G"

NA

NA

"H"

NA

NA

"I"

NA

NA

"J"

NA

NA

"K"

NA

NA

"L"

NA

NA

"M"

NA

NA

"N"

NA

NA

"O"

NA

NA

"P"

NA

NA

"Q"

NA

NA

"R"

NA

NA

"S"

NA

NA

"T"

NA

NA

"V"

NA

NA

"W"

NA

NA

"X"

NA

NA

"Y"

NA

NA

"Z"

NA

NA

"WindowsLeft"

NA

NA

"WindowsRight"

NA

NA

"Application"

NA

NA

"Numpad0"

NA

NA

"Numpad1"

NA

NA

"Numpad2"

NA

NA

"Numpad3"

NA

NA

"Numpad4"

NA

NA

"Numpad5"

NA

NA

"Numpad6"

NA

NA

"Numpad7"

NA

NA

"Numpad8"

NA

NA

"Numpad9"

NA

NA

"NumpadAsterisk"

NA

NA

"NumpadPlus"

NA

NA

"NumpadDash"

NA

NA

"NumpadPeriod"

NA

NA

"NumpadForwardslash"

NA

NA

"F1"

NA

NA

"F2"

NA

NA

"F3"

NA

NA

"F4"

NA

NA

"F5"

NA

NA

"F6"

NA

NA

"F7"

NA

NA

"F8"

NA

NA

"F9"

NA

NA

"F10"

NA

NA

"F11"

NA

NA

"F12"

NA

NA

"NumLock"

NA

NA

"ScrollLock"

NA

NA

";"

NA

NA

"="

NA

NA

"

NA

NA

"

NA

NA

"-"

NA

NA

"."

NA

NA

"/"

NA

NA

"`"

NA

NA

"["

NA

NA

"\\"

NA

NA

"]"

NA

NA

"'"

NA

NA

"Function"

NA

NA

Returns

(number)
-1 : The specified key is not supported or does not exist
If the action is successful then the key code is returned


KeyBind.GetKeyCount


(number) KeyBind.GetKeyCount ( 

(string) Key Table )

Description

Gets the count of key bindings in a key table.

Parameters

Key Table

(string) The name of the key table for which to count the keys.

Note: Set this to "" or nil to use the default key table.

Returns

(number)
-2 : The specified key table does not exist or is empty
If the action is successful then the number of keys in the specifed table is returned.


KeyBind.GetKeyName


(string) KeyBind.GetKeyName ( 

(number) Key = KeyBind.Key.LWin )

Description

Gets the key name given the key code.

Parameters

Key

(number) The key code number of the key whose name is being requested.

Returns

(string)
-1 : The specified key is not supported or does not exist
If the action is succesful then the name of the key is returned.


KeyBind.GetKeyTableCount


(number) KeyBind.GetKeyTableCount ()

Description

Gets the total number of key tables.

Returns

(number)
Returns the number of key tables.


KeyBind.GetKeyTableNames


(table) KeyBind.GetKeyTableNames ()

Description

Gets the names of all key tables.

Returns

(table)
Returns a numerically indexed table containing the names of the key tables.
If an error occurs or no tables exist then nil is returned.


KeyBind.KeyIsBound


(boolean) KeyBind.KeyIsBound ( 

(number) Key = KeyBind.Key.Tab,

(string) Key Table )

Description

Determines whether or not a key is bound to a specific key table..

Parameters

Key

(number) The key code number of the key whose bound status is being requested.

Key Table

(string) The name of the key table upon which the action will be executed.

Note: Set this to "" or nil to use the default key table.

Returns

(boolean)
-1 : The specified key is not supported or does not exist
Returns true if the key is bound to the specifed table and false if it is not.


KeyBind.KeyTableDoesExist


(boolean) KeyBind.KeyTableDoesExist ( 

(string) Key Table = "My Keys" )

Description

Detrmines whether or not a specific key table exists.

Parameters

Key Table

(string) The name of the key table whose existence is being confirmed.

Returns

(boolean)
Returns true if the table exist and false if it does not.


KeyBind.LoadSettings


(number) KeyBind.LoadSettings ( 

(string) File = "C:\\Test.kbs",

(string) Source Key Table = "Custom Key Set",

(string) Target Key Table,

(string) Decryption Key )

Description

Loads key binding settings from a file.

Parameters

File

(string) The full path to the key bindings file.

Note: This file will have been created by the KeyBind.SaveSettings() function.

Source Key Table

(string) The name of the key table which will be loaded from the settings file.

Note: Set this to "" or nil to use the default key table.

Target Key Table

(string) The name of the key table which will adopt the loaded key settings.

Note: Set this to "" or nil to use the default key table.

Decryption Key

(string) The string that will be used to decrypt the code portion of the key attributes.

Note: Set this to "" or nil to ignore the decryption process.

Returns

(number)
-6 : The specified source table section does not exist, is empty or is corrupt
-5 : File does not exist
0 : Action was successful


KeyBind.OnKey


KeyBind.OnKey ( 

(number) e_Key = e_Key,

(table) e_Modifiers = e_Modifiers,

(string) Key Table )

Description

Executes code for all key tables and key bindings.

Note: This must be placed in the On Key event of the page, dialog, object or project.

Parameters

e_Key

(number) The arguement passed to the program when a key is pressed.

Note: DO NOT change this argument.

e_Modifiers

(table) The arguement passed to the program when a modifier is pressed.

Note: DO NOT change this argument.

Key Table

(string) The name of the key table which will be referenced when a key or key combination is pressed.

Note: Set this to "" or nil to use the default key table.

Returns

This action dose not return any value.


KeyBind.SaveSettings


(number) KeyBind.SaveSettings ( 

(string) File = "C:\\Test.kbs",

(string) Key Table,

(string) Encryption Key )

Description

Saves key binding settings to a file for later recall.

Parameters

File

(string) The full path to where the file will be saved.

Note: The file need not exist prior to saving.

Key Table

(string) The name of the key table whose key data will be saved.

Note: Set this to "" or nil to use the default key table.

Encryption Key

(string) The string that will be used to encrypt the code portion of the key attributes.

Note: Set this to "" or nil to ignore the encryption process.

Returns

(number)
0 : Action was successful
If a file error occurs then the error code is returned.


KeyBind.SetKeyAtt


(number) KeyBind.SetKeyAtt ( 

(number) Key = KeyBind.GetKeyCode("Enter"),

(string) Text,

(string) Description,

(boolean) Shift = nil,

(boolean) Ctrl = nil,

(boolean) Alt = nil,

(string) Script,

(string) Key Table )

Description

Sets attributes for an existing key binding.

Parameters

Key

(number) The key code number of the key whose attributes are being requested.

Text

(string) This is a short description of the key's action.

Note: Not required

Description

(string) This is a long description of the key's action.

Note: Not Required

Shift

(boolean) Requires the Shift modifier.

Note: Not required.

Ctrl

(boolean) Requires the Ctrl modifier.

Note: Not required.

Alt

(boolean) Requires the Alt modifier.

Note: Not required.

Script

(string) The script that will be executed when the key (or key combination) is pressed.

Note: Not required but rocommended.

Key Table

(string) The name of the key table upon which the action will be executed.

Note: Set this to "" or nil to use the default key table.

Returns

(number)
-3 : The specified key is unbound
-1 : The specified key is not supported or does not exist
0 : Action was successful


KeyBind.UpdateGrid


(number) KeyBind.UpdateGrid ( 

(string) Object = "Grid1",

(boolean) Include Description = false,

(number) ResizeMode = GVS_DEFAULT,

(string) Key Table )

Description

Displays key binding settings in a grid object.

Parameters

Object

(string) The name of the grid object upon which the key data will be displayed.

Include Description

(boolean) Whether or not to include each key's desciption attribute on the grid.

ResizeMode

(number) How each column in the grid will be resized.

Note: Set this to nil to use the default setting.

CONSTANT

VALUE

DESCRIPTION

GVS_DEFAULT

0

Use the default behavior which is to make the column as small as it can be while still accommodating all of its text. (Default)

GVS_HEADER

1

Make the column resize according to the size of the text in the header cell.

GVS_DATA

2

Make the column resize to the widest non-header cell in the column.

GVS_BOTH

3

Mixes both GVS_HEADER and GVS_DATA using whichever is the widest in the column.

Key Table

(string) The name of the key table to load into the grid.

Note: Set this to "" or nil to use the default key table.

Returns

(number)
-8 : Object does not exist
0 : Action was successful



Copyright © 2010 AMSPublic.com
This File Was Generated With AMS ActionFile Editor