Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
96 lines (61 loc) · 1.65 KB

File metadata and controls

96 lines (61 loc) · 1.65 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
'''
Sendkeys module moved back to ctypes.
For x64 systems, for example.
(c) 2009 Igor S. Mandrigin, Agnitum Ltd.
'''
from ctypes import windll
# from the internet
KEYEVENTF_KEYUP = 2
VK_NUMLOCK = 144
KEYEVENTF_EXTENDEDKEY = 1
KEYEVENTF_KEYUP = 2
def _key_down( vk ) :
scan = windll.user32.MapVirtualKeyA( vk, 0 )
windll.user32.keybd_event( vk, scan, 0, 0 )
def _key_up( vk ) :
scan = windll.user32.MapVirtualKeyA( vk, 0 )
windll.user32.keybd_event( vk, scan, KEYEVENTF_KEYUP, 0 )
def toggle_numlock( turn_on ) :
'''
toggle_numlock(int) -> int
Turns NUMLOCK on or off and returns whether
it was originally on or off.
'''
is_on = 0
keys = [];
is_on = windll.user32.GetKeyState( VK_NUMLOCK ) & 1
if is_on != turn_on :
windll.user32.keybd_event(VK_NUMLOCK,
69,
KEYEVENTF_EXTENDEDKEY | 0,
0);
windll.user32.keybd_event(VK_NUMLOCK,
69,
KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);
return is_on
def char2keycode( char ) :
'''
char2keycode(char) -> int
Converts character to virtual key code
'''
vk = windll.user32.VkKeyScanA( ord( char ) )
return vk
def key_down( key ) :
'''
key_down(int) -> None
Generates a key pressed event. Takes a
virtual key code.
'''
vk = key
# XXX exception if >= 256
_key_down( vk )
def key_up( key ) :
'''
key_up(int) -> None
Generates a key released event. Takes a
virtual key code.
'''
vk = key
# XXX exception if >= 256
_key_up( vk )
Morty Proxy This is a proxified and sanitized view of the page, visit original site.