Skip to content

Commit

Permalink
Profile link and more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-kukiela authored Aug 20, 2017
1 parent b265a4a commit 5ec38c7
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions keys.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Code by Daniel Kukiela
# Code by Daniel Kukiela (https://twitter.com/daniel_kukiela)

import ctypes
from threading import Thread
Expand Down Expand Up @@ -549,16 +549,40 @@ class INPUT(ctypes.Structure):
#example:
if __name__ == '__main__':
sleep(3)
keys = Keys({})
keys = Keys()

# mouse movement
for i in range(100):
keys.keys_worker.SendInput(keys.keys_worker.Mouse(0x0001, -1*i, 0))
keys.directMouse(-1*i, 0)
sleep(0.004)

# mouse keys
keys.directMouse(buttons=keys.mouse_rb_press)
sleep(0.5)
keys.directMouse(buttons=keys.mouse_lb_press)
sleep(2)
keys.directMouse(buttons=keys.mouse_lb_release)
sleep(0.5)
keys.directMouse(buttons=keys.mouse_rb_release)

# or
keys.directMouse(buttons=keys.mouse_lb_press | keys.mouse_rb_press)
sleep(2)
keys.directMouse(buttons=keys.mouse_lb_release | keys.mouse_rb_release)

# keyboard (direct keys)
keys.directKey("a")
sleep(0.04)
keys.directKey("a", keys.key_release)

# keyboard (virtual keys)
keys.directKey("a", type=keys.virtual_keys)
sleep(0.04)
keys.directKey("a", keys.key_release, keys.virtual_keys)

# queue of keys (direct keys, threaded, only for keybord input)
keys.parseKeyString("a_down,-4,a_up,0x01") # -4 - pause for 4 ms, 0x00 - hex code of Esc

# queue of keys (virtual keys, threaded, only for keybord input)
keys.parseKeyString("vk,a_down,-4,a_up") # -4 - pause for 4 ms

0 comments on commit 5ec38c7

Please sign in to comment.