Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 881 Bytes

wiki.md

File metadata and controls

35 lines (25 loc) · 881 Bytes

Contributing to autokey wiki samples

Dynamically assign hotkey actions

Author: tomrule007

Description: Sample script that uses global value to toggle hotkey actions.

Enable script - sets enabled True and passes hotkey through.

store.set_global_value("enabled", True)
keyboard.send_keys("<escape>")

Disable script - sets enabled False and passes hotkey through.

store.set_global_value("enabled", False)
keyboard.send_keys(" ")

Action script - checks global value to determine action and also handles unset global with a default setting.

try:
    enabled = store.get_global_value("enabled")
except TypeError:
    enabled = True #default setting

if enabled:
    # Do this if enabled.
else:
    # Do this if disabled.