-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhdaps-pivot
More file actions
executable file
·54 lines (45 loc) · 1.23 KB
/
hdaps-pivot
File metadata and controls
executable file
·54 lines (45 loc) · 1.23 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
'''
hdaps-pivot - read hdaps position and print it
'''
# Copyright: 2008-2009 Evgeni Golov <sargentd@die-welt.net>
# License: GPL-2
from hdaps import *
from time import sleep
import getopt
import sys
__version__ = "0.1"
def pivot(count=1000, verbose=False):
calX,calY = readPosition(True)
print('(x,y) base: (%u,%u)' % (calX, calY))
for i in range(0,count):
posX,posY = readPosition()
print('(x,y) position: (%i,%i)' % (posX-calX, posY-calY))
if verbose:
print('keyboard=%i mouse=%i' % (readKeyboardActivity(), readMouseActivity()))
sleep(0.25)
def usage():
print('hdaps-pivot from pyhdaps, version %s' % __version__)
print('\nOptions:')
print('\t-c, --count <count>\tthe count of rounds it will print')
print('\t-v, --verbose\tprint also keyboard and mouse activity')
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "hc:v", ["help", "count=", "verbose"])
except getopt.GetoptError as err:
print(str(err))
usage()
sys.exit(2)
verbose = False
count = 1000
for o, a in opts:
if o in ("-v", "--verbose"):
verbose = True
elif o in ("-h", "--help"):
usage()
sys.exit()
elif o in ("-c", "--count"):
count = int(a)
pivot(count, verbose)
if __name__ == '__main__':
main()