-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecord.py
More file actions
33 lines (27 loc) · 739 Bytes
/
record.py
File metadata and controls
33 lines (27 loc) · 739 Bytes
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
from ahk import AHK
import time
import sys
import pyscreenshot as ImageGrab
import constants as c
ahk = AHK()
SCREENSHOT_INTERVAL = .5
def screenshot():
window = ahk.active_window
x = window.position[0]
y = window.position[1]
h = window.height
w = window.width
im = ImageGrab.grab(bbox=(x, y+c.SCREEN_SHOT_Y_REMOVAL, x + w, y + h))
t = time.time()
location = "record\\screenshot" + str(t) + ".png"
im.save(location)
print("Window Captured:", str(location), flush=True)
looping = True
try:
while looping:
screenshot()
time.sleep(SCREENSHOT_INTERVAL)
except KeyboardInterrupt as e:
print("Waiting for screenshot thread to close...")
print("exiting..")
sys.exit()