forked from ali-raheem/eZ430-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathppt-mac.py
31 lines (25 loc) · 766 Bytes
/
ppt-mac.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
#!/usr/bin/env python
import os, eZ430
from time import sleep
verbose = 1 # set this to 0 if you don't want detailed log
watch = eZ430.watch("/dev/tty.usbmodem001") #replace this
# commands
leftcmd = """
osascript -e 'tell application "System Events" to key code 124'
"""
rightcmd = """
osascript -e 'tell application "System Events" to key code 123'
"""
while 1:
data = watch.read(7)
button = int(ord(data[6]))
if(button == 18):
if(verbose): print "Right pressed."
os.system(rightcmd)
watch.debounce()
sleep(0.3) # sleep for 300 ms. So that the slide doesn't move very fast
elif(button == 50):
if verbose: print "Left pressed."
os.system(leftcmd)
watch.debounce()
sleep(0.3) # sleep for 300 ms. So that the slide doesn't move very fast