-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
40 lines (31 loc) · 1023 Bytes
/
main.py
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
#!/usr/bin/python3
import pyxhook
import time
from CaptureTime import CaptureTime
#20210123 MH: Create CaptureTime object
capTime = CaptureTime()
#20210123 MH: Campture subject name
user = input("Enter your name: ")
capTime.setUser(user)
#20210123 MH: seting total sessions and reps per session
sessionFreq = input("Set number of session: ")
capTime.setSessionFreq(int(sessionFreq))
entryFreq = input("Set number of reps per session: ")
capTime.setEntryFreq(int(entryFreq))
##20210123 MH: Create dictionary which will be use to storage raw times
capTime.CreateDicTimes()
#Create hookmanager
hookman = pyxhook.HookManager()
#Define our callback to fire when a key is pressed down
hookman.KeyDown = capTime.KeyDownEvent
hookman.KeyUp = capTime.KeyUpEvent
#Hook the keyboard
hookman.HookKeyboard()
#Start our listener
hookman.start()
capTime.CalculateKeystrokesDynamics()
#Create a loop to keep the application running
while capTime.running:
time.sleep(0.1)
#Close the listener when we are done
hookman.cancel()