Executor API

The executor is the JSON action interpreter that parses and executes automation scripts.


execute_action

execute_action(action_list)

Executes all actions in the given action list.

Parameters:

action_list (list or dict) – A list of actions to execute. Each action is a list of [function_name, {params}].

Returns:

Dictionary mapping each action to its return value.

Return type:

dict

Example:

from je_auto_control import execute_action

result = execute_action([
    ["AC_set_mouse_position", {"x": 100, "y": 200}],
    ["AC_click_mouse", {"mouse_keycode": "mouse_left"}]
])

execute_files

execute_files(execute_files_list)

Executes all JSON action files in the given list.

Parameters:

execute_files_list (list) – List of file paths to execute.

Returns:

List of execution results for each file.

Return type:

list

Example:

from je_auto_control import execute_files, get_dir_files_as_list

execute_files(get_dir_files_as_list("./actions/"))

add_command_to_executor

add_command_to_executor(command_dict)

Adds custom commands to the executor’s event dictionary.

Parameters:

command_dict (dict) – Dictionary of {"command_name": callable} to add.

Example:

from je_auto_control import executor

def my_custom_function(message):
    print(f"Custom: {message}")

executor.event_dict["my_func"] = my_custom_function