28 lines
1.5 KiB
Python
28 lines
1.5 KiB
Python
|
from pynput.keyboard import Key
|
||
|
|
||
|
# --- Configuration Constants ---
|
||
|
STOP_KEY = Key.f6 # The global key to stop the AutoHotkey script listener
|
||
|
RETRY_WINDOW_SECONDS = 2 # Not directly used in current AHK template, but kept for context
|
||
|
AHK_LOG_MONITOR_INTERVAL = 0.5 # Interval to check AHK log file for new messages
|
||
|
|
||
|
# Path to the external AutoHotkey template file, now relative from model/ to resources/
|
||
|
AHK_TEMPLATE_REL_PATH_FROM_MODEL_DIR = os.path.join(os.pardir, "resources", "template.ahk")
|
||
|
|
||
|
# List of common AutoHotkey.exe installation paths and fallbacks.
|
||
|
AHK_EXECUTABLE_FALLBACK_PATHS = [
|
||
|
"C:\\Program Files\\AutoHotkey\\v2\\AutoHotkey.exe", # Common AHK v2 install path
|
||
|
"C:\\Program Files\\AutoHotkey\\AutoHotkey.exe", # Common AHK v1 install path
|
||
|
"AutoHotkey.exe" # Fallback: relies on system PATH or current working directory
|
||
|
]
|
||
|
|
||
|
# Mapping for common key names to AutoHotkey v2 equivalents.
|
||
|
AUTOHOTKEY_KEY_MAP = {
|
||
|
'+': 'NumpadAdd', 'num+': 'NumpadAdd', 'numpad+': 'NumpadAdd',
|
||
|
'enter': 'Enter', 'return': 'Enter', 'space': 'Space',
|
||
|
'esc': 'Escape', 'del': 'Delete', 'Backspace': 'Backspace',
|
||
|
'tab': 'Tab', 'shift': 'Shift', 'ctrl': 'Control', 'control': 'Control',
|
||
|
'alt': 'Alt', 'up': 'Up', 'down': 'Down', 'left': 'Left', 'right': 'Right',
|
||
|
'f1': 'F1', 'f2': 'F2', 'f3': 'F3', 'f4': 'F4', 'f5': 'F5', 'f6': 'F6',
|
||
|
'f7': 'F7', 'f8': 'F8', 'f9': 'F9', 'f10': 'F10', 'f11': 'F11', 'f12': 'F12'
|
||
|
}
|