[python-win32] WMI troubles!

Tim Golden mail at timgolden.me.uk
Fri Jan 15 21:31:42 CET 2010


On 15/01/2010 19:38, Alex Hall wrote:
> I do not want a single script because, eventually, the plan is to have a
> keystroke for core 1, a keystroke for core 2, a keystroke for percent of
> ram used, a keystroke for hard disk space, and so on. While I could
> write each function in its own script and put a hotkey on each one, it
> seems easier and faster to just make one script and run it once,
> avoiding the delay I always get when this script runs for the first time
> from happening each time I press a hotkey.

I've got slightly lost in this thread (not helped, I'm
afraid Alex, by your habit of top-posting ;) ) but in
an effort to be helpful, can I suggest the following.
Instead of fiddling with pyHooks which are -- as Tim R
points out -- somewhat dark and messy, consider adapting
the following example instead:

http://timgolden.me.uk/python/win32_how_do_i/catch_system_wide_hotkeys.html

This uses a straightforward Windows message loop to
provide to sort of global hotkeys I think you're after.
You might, for example, change the handle_win_f3
function to start a wmi instance (or use an existing
one) and then produce the output you were after.

TJG


More information about the python-win32 mailing list