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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| from ctypes import * #Pour l'utilisation des libraires en C
import time
#Structures utilisées pour l'appui des touches
class ki(Structure):
_fields_ = [("wVk", c_ushort),
("wScan", c_ushort),
("dwFlags", c_ulong),
("time", c_ulong),
("dwExtraInfo", POINTER(c_ulong))]
class hi(Structure):
_fields_ = [("uMsg", c_ulong),
("wParamL", c_short),
("wParamH", c_ushort)]
class mi(Structure):
_fields_ = [("dx", c_long),
("dy", c_long),
("mouseData", c_ulong),
("dwFlags", c_ulong),
("time",c_ulong),
("dwExtraInfo", POINTER(c_ulong))]
class Input_I(Union):
_fields_ = [("ki", ki),
("mi", mi),
("hi", hi)]
class Input(Structure):
_fields_ = [("type", c_ulong),
("ii", Input_I)]
#Fonction de l'appui de la touche RCONTROL
def CONTROLUP():
RCONTROLUPInput = Input
RCONTROLUP = Input_I()
RCONTROLUP.ki = ki(163, 0, 0, 0, pointer(c_ulong(0))) #163
RCONTROL = RCONTROLUPInput(1, RCONTROLUP)
windll.user32.SendInput(1, pointer(RCONTROL), sizeof(RCONTROL))
time.sleep(0.5)
print "Appui enfonce de la touche RCONTROL"
#Fonction de l'appui et du relachement de la touche SCROLL
def SCROLL():
SCROLLInputs = Input * 2
i = 0
while i < 4:
SCROLLUP = Input_I()
SCROLLUP.ki = ki(145, 0, 0, 0, pointer(c_ulong(0)))
SCROLLDOWN = Input_I()
SCROLLDOWN.ki = ki(145, 0, 2, 0, pointer(c_ulong(0)))
SCROLL = SCROLLInputs( (1, SCROLLUP), (1, SCROLLDOWN) )
windll.user32.SendInput(2, pointer(SCROLL), sizeof(SCROLL[0]))
i = i + 1
time.sleep(0.5)
if i == 1 or i == 3:
print "Appui de la touche SCROLL"
else:
print "Relachement de la touche SCROLL"
#Fonction du relachement de la touche RCONTROL
def CONTROLDOWN():
RCONTROLDOWNInput = Input
RCONTROLDOWN = Input_I()
RCONTROLDOWN.ki = ki(163, 0, 2, 0, pointer(c_ulong(0))) #163
RCONTROL = RCONTROLDOWNInput(1, RCONTROLDOWN)
windll.user32.SendInput(1, pointer(RCONTROL), sizeof(RCONTROL))
print "Appui relache de la touche RCONTROL"
CONTROLUP()
SCROLL()
CONTROLDOWN() |
Partager