Exemple #1
0
def press_sequence(sequence):
    print("Pressing sequence " + sequence + ": ", end="")
    for key in sequences[sequence]:
        print(key + ", ", end="")
        keycode = int(codes[key], 16)
        keybd_event(keycode, MapVirtualKey(keycode, 0), 0, 0)  # press
    print("")
    time.sleep(0.3)

    for key in sequences[sequence][::-1]:
        keycode = int(codes[key], 16)
        keybd_event(keycode, MapVirtualKey(keycode, 0), 2, 0)  # release
Exemple #2
0
 def stopSong(self):
     keybd_event(0xB2, MapVirtualKey(0xB2, 0))
Exemple #3
0
 def nextSong(self):
     keybd_event(0xB0, MapVirtualKey(0xB0, 0))
Exemple #4
0
def press_key(key):
    print("Pressing " + key)
    keycode = int(codes[key], 16)
    keybd_event(keycode, MapVirtualKey(keycode, 0))
Exemple #5
0
 def send_keypress(self, key: int):
     virtual_key = MapVirtualKey(key, 0)
     PostMessage(self._hwnd, WM_KEYDOWN, key, 0x0001 | virtual_key >> 16)
Exemple #6
0
 def send_keyrelease(self, key: int):
     virtual_key = MapVirtualKey(key, 0)
     PostMessage(self._hwnd, WM_KEYUP, key, 0x0001 | virtual_key >> 16 | 0xC0 >> 24)
Exemple #7
0
 def push_button(self, key):
     lparam = (MapVirtualKey(key, 0) << 16) + 1
     PostMessage(self.hwnd, win32con.WM_KEYDOWN, key, lparam)
     sleep(0.5)
     PostMessage(self.hwnd, win32con.WM_KEYUP, key, lparam)
Exemple #8
0
 def nextSong():
     # ## Restart the song
     keybd_event(0xB0, MapVirtualKey(0xB0, 0))
Exemple #9
0
 def restartSong():
     # ## Restart the song
     keybd_event(0xB1, MapVirtualKey(0xB1, 0))
Exemple #10
0
 def playPause():
     keybd_event(0xB3, MapVirtualKey(0xB3, 0))
 def playSong(self):
     ## Play the song
     keybd_event(0xB3, MapVirtualKey(0xB3, 0))
     ## Restart the song
     keybd_event(0xB1, MapVirtualKey(0xB1, 0))