Skip to content

A wrapper around commonly used win32api functions for controlling windows.

Notifications You must be signed in to change notification settings

thijsdezoete/virtualkeys.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

***Requires Pywin32 (https://sourceforge.net/projects/pywin32/)***


virtualkeys.py wraps up a portion of the win32api module in an effort to make
it easier for beginners to use.

Rather than calling win32api.keybd_event(dwFlag,dx,dy,dwData) and filling it
with the proper key codes (which you would have to look up on
http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
unless you have somekind of super memory.) I've wrapped everything in a series 
of functions called called press().

To virtually push a key -- that is, one press, one release -- all you need to
call is press(*args), where the argument is a string containing the key you wish
to press. e.g. press('a','b','c'). This presses, in order, one at a time the
key names passed to it.

All keyboard functions in this module follow this theme.

The only one that doesn't is 'typer()'. This accepts whole words (or series of 
words) as arguments. e.g. 'Hello World!' which it will loop through, interpret, 
and press the appropriate key.

It's just more convenient than using press() and seperating each letter by a
comma. Note that this version alos catches special characters such as 
'~!@#$%^&*()_+=-[]{};':",.<>/?'. I got a little too lazy to add them into the 
press() function. 

I've added a few commonly used functions such as Copy and Paste for direct 
calling. 

Finally, all mouse functions (excluding the MOUSE_WHEEL) follow this argment
style: Mouse('button'). Where button is 'left', 'middle', or 'right'.

MouseWheel takes two arguments. A directions parameter, and an'amount'
parameter. This controls how many 'clicks' and in which direction.

Note: ALL VK_CODE strings are lower case and follow the word_word style. e.g.
'caps_lock', 'left_arrow', 'print_screen', etc..


Note: Music my Pitx

About

A wrapper around commonly used win32api functions for controlling windows.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published