Python - Hot Keys - Run Code With Keyboard Key Press

Python - Hot Keys - Run Code With Keyboard Key Press

TAB Nation - Automation

2 года назад

6,219 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@superstayup
@superstayup - 15.02.2022 23:20

AutoKey

Ответить
@capro8914
@capro8914 - 24.04.2022 19:31

can you show one where you can toggle a loop code on and off by pressing the same button

Ответить
@purushothamaraju
@purushothamaraju - 21.05.2022 11:26

Hi, Tab Nation, your script is very useful; however, you have not explained to make the 'execute' function to do different things with different combination of keys, could you please make another video to explain this

Ответить
@frontdesk4368
@frontdesk4368 - 18.11.2022 12:41

Hrm, interesting.

if I hit SHIFT, nothing happens. SHIFT+A then it runs, but after 5 seconds if I just hit SHIFT it also runs the code.

Ответить
@password9384
@password9384 - 21.01.2023 18:05

when I press A it executes program and types A, cant figure out how to make it execute code without typing a hotkey, for example, pressing F1 as a hotkey without trigering "help" feature on a web browser.....

Ответить
@password9384
@password9384 - 22.01.2023 17:07

this is 100X better way to do this thing, you're welcome

import keyboard

def f1_Pressed():
print('F1 was pressed')


def f2_Pressed():
print('F2 was pressed')

keyboard.remap_hotkey("F1", "F8")
keyboard.add_hotkey('F1', f1_Pressed)

keyboard.remap_hotkey("F2", "F8")
keyboard.add_hotkey('F2', f2_Pressed)

while True:
keyboard.wait()

Ответить