P
P
Pickto2016-12-30 10:09:12
Python
Pickto, 2016-12-30 10:09:12

How to make a script press keys in the background?

There is a script that should press the F2 key in the background,

win32api.keybd_event(win32con.VK_F2, 0, 0, 0)
win32api.keybd_event(win32con.VK_F2, 0, win32con.KEYEVENTF_KEYUP, 0)

When the script is open, everything works. As soon as I collapse it, it decides that it is not necessary to press F2.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Роман, 2016-12-30
@ZinBu

Можно попробовать сохранить скрипт в расширении *.pyw
В таком случае он должен запускаться скрыто, может поможет.
А так я помню у меня была такая же проблема с библиотекой pyHook, проблему так и не решил.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question