Package lib :: Module scripting :: Class Engine
[hide private]
[frames] | no frames]

Class Engine

source code

Provides access to the internals of AutoKey.

Note that any configuration changes made using this API while the configuration window is open will not appear until it is closed and re-opened.

Instance Methods [hide private]
 
__init__(self, configManager, runner) source code
 
get_folder(self, title)
Retrieve a folder by its title
source code
 
create_phrase(self, folder, description, contents)
Create a text phrase
source code
 
create_abbreviation(self, folder, description, abbr, contents)
Create a text abbreviation
source code
 
create_hotkey(self, folder, description, modifiers, key, contents)
Create a text hotkey
source code
 
run_script(self, description)
Run an existing script using its description to look it up
source code
 
run_script_from_macro(self, args)
Used internally by AutoKey for phrase macros
source code
list(str())
get_macro_arguments(self)
Get the arguments supplied to the current script via its macro
source code
 
set_return_value(self, val)
Store a return value to be used by a phrase macro
source code
 
_get_return_value(self)
Used internally by AutoKey for phrase macros
source code
Method Details [hide private]

get_folder(self, title)

source code 

Retrieve a folder by its title

Usage: engine.get_folder(title)

Note that if more than one folder has the same title, only the first match will be returned.

create_phrase(self, folder, description, contents)

source code 

Create a text phrase

Usage: engine.create_phrase(folder, description, contents)

A new phrase with no abbreviation or hotkey is created in the specified folder

Parameters:
  • folder - folder to place the abbreviation in, retrieved using engine.get_folder()
  • description - description for the phrase
  • contents - the expansion text

create_abbreviation(self, folder, description, abbr, contents)

source code 

Create a text abbreviation

Usage: engine.create_abbreviation(folder, description, abbr, contents)

When the given abbreviation is typed, it will be replaced with the given text.

Parameters:
  • folder - folder to place the abbreviation in, retrieved using engine.get_folder()
  • description - description for the phrase
  • abbr - the abbreviation that will trigger the expansion
  • contents - the expansion text
Raises:
  • Exception - if the specified abbreviation is not unique

create_hotkey(self, folder, description, modifiers, key, contents)

source code 

Create a text hotkey

Usage: engine.create_hotkey(folder, description, modifiers, key, contents)

When the given hotkey is pressed, it will be replaced with the given text. Modifiers must be given as a list of strings, with the following values permitted:

<ctrl> <alt> <super> <hyper> <shift>

The key must be an unshifted character (i.e. lowercase)

Parameters:
  • folder - folder to place the abbreviation in, retrieved using engine.get_folder()
  • description - description for the phrase
  • modifiers - modifiers to use with the hotkey (as a list)
  • key - the hotkey
  • contents - the expansion text
Raises:
  • Exception - if the specified hotkey is not unique

run_script(self, description)

source code 

Run an existing script using its description to look it up

Usage: engine.run_script(description)

Parameters:
  • description - description of the script to run
Raises:
  • Exception - if the specified script does not exist

get_macro_arguments(self)

source code 

Get the arguments supplied to the current script via its macro

Usage: engine.get_macro_arguments()

Returns: list(str())
the arguments

set_return_value(self, val)

source code 

Store a return value to be used by a phrase macro

Usage: engine.set_return_value(val)

Parameters:
  • val - value to be stored