Skip to content
Hoai Phuoc Truong edited this page Feb 10, 2020 · 5 revisions

Task API

There are several APIs available when programming a task. They can be used to determined how the task was invoked, so that the task can react accordingly. In addition, there are also APIs to control mouse, keyboard, and other miscellaneous components.

Task Activation

As mentioned in Getting started section, there are several ways to invoke a task. When programming a task with multiple activation methods, it is useful to know how the task was invoked to act accordingly. For example, if a task can be invoked with key chain "A + B" and key chain "A + C", the programming logic could be like the following:

...
if (kc.get(1).k()) == VK_B) {
 // Do one thing.
} else {
 // Do other thing.
}

The complete KeyStroke class can be found here. The two most important methods are k() which returns the key being pressed, and m() which returns the key modifier (either left or right for certain keys like Ctrl or Shift).

Global key activation

The key stroke that invokes the task will be available via KeyChain kc variable.

Shared variables

This exposes everything in SharedVariables class.

See Shared variables wiki for more details.

MouseCore

This exposes everything in MouseCore.

KeyboardCore

This exposes everything in KeyboardCore.

Tools

Tools is a static library that contains several useful functionalities. The complete API can be found here

Clone this wiki locally