D
D
Dmitry2021-05-24 22:44:54
Python
Dmitry, 2021-05-24 22:44:54

How to make hotkey in python ahk module?

Recently I wrote a little thing, which I am generally satisfied with. But in the end, I needed some kind of switch (I pressed the button / combination - the value of the variable changed). I previously implemented this using the keyboard module, but I don't want to import it. Is there a way to do this while being limited to the ahk module?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeniy _, 2021-05-25
@GeneD88

from ahk import AHK, Hotkey

ahk = AHK()

key_combo = '#n' # Назначаете комбо, здесь пример на WIn+n, который запустит Notepad
script = 'Run Notepad' 
hotkey = Hotkey(ahk, key_combo, script) # Создаете хотки
hotkey.start()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question