1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from pynput import keyboard
from PIL import ImageGrab
from ctypes import windll
from time import sleep
OpenClipboard = windll.user32.OpenClipboard
EmptyClipboard = windll.user32.EmptyClipboard
CloseClipboard = windll.user32.CloseClipboard
COMBINATIONS = [
{keyboard.Key.cmd, keyboard.Key.shift, keyboard.KeyCode(char='s')},
]
current = set()
def execute():
print ("Ready To Screen")
OpenClipboard(None)
EmptyClipboard()
CloseClipboard()
current.clear()
for _ in range(10):
im = ImageGrab.grabclipboard()
if im:
im.show()
break
else:
sleep(1)
def on_press(key):
if any([key in COMBO for COMBO in COMBINATIONS]):
current.add(key)
if any(all(k in current for k in COMBO) for COMBO in COMBINATIONS):
execute()
def on_release(key):
if any([key in COMBO for COMBO in COMBINATIONS]):
current.remove(key)
with keyboard.Listener(on_press=on_press, on_release=on_release) as listener:
listener.join()