[python-win32] Programmatically switch desktops in windows 10?

2017-04-16 Thread reckoner

Windows 10 has multiple desktops built-in. Is it it possible to
programmatically switch between desktops? How about programmatically 
moving an active window between desktops?


Thanks!

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Figuring out why a window is losing focus

2016-02-08 Thread reckoner


Where can I safely download this Spy program you are all talking about?

Thanks!



On 2/8/2016 9:00 AM, python-win32-requ...@python.org wrote:

Re: Figuring out why a window is losing focus

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] getting Windows key codes

2015-03-31 Thread reckoner

The easiest thing to do is follow the instructions here:

   http://ahkscript.org/docs/KeyList.htm#SpecialKeys

And use the keyboard hook to report the keystrokes. Then, you can use

   https://github.com/t4ngo/dragonfly

To do all the key re-mapping. by the way, the dragonfly source code has 
all the ctypes calls to interact with the keyboard. Just about every key 
and key combination  you can think of is in there.


I hope that helps.

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Programmatically turn off mouse auto-positioning

2014-02-07 Thread reckoner

 Am 04.02.2014 19:51, schrieb reckoner:
  Hi,
 
  In the control panel, under mouse settings, there is a checkbox to
  automatically move the mouse to the default button in a dialog box.
 
  Is there a way to programmatically turn this off/on using Python? I'm
  referring to windows 7/8.
 
  Thanks!

 SystemParametersInfo with the SPI_SETSNAPTODEFBUTTON parameter.
 No idea if pywin32 exposes this but there's always ctypes.


Thanks for the tip! For posterity, here it is:

def set_mouse_autosnap_to_default(state):
   The mouse is auto-positioned in the control panel. This turns 
on/off this

   auto-snap.

   :state: True/False (set to bool)
   
   h = ctypes.c_void_p()
   # set postion
   ctypes.windll.user32.SystemParametersInfoW(0x60,state,ctypes.byref(h),0)
   # recover position
   # print 
ctypes.windll.user32.SystemParametersInfoW(0x5F,0,ctypes.byref(h),0)

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Programmatically turn off mouse auto-positioning

2014-02-04 Thread reckoner

Hi,

In the control panel, under mouse settings, there is a checkbox to 
automatically move the mouse to the default button in a dialog box.


Is there a way to programmatically turn this off/on using Python? I'm 
referring to windows 7/8.


Thanks!

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Sending Keystrokes to Active Windows (leegold)

2013-07-11 Thread reckoner



Use dragonfly:

https://code.google.com/p/dragonfly/

Then,

(FocusWindow(title='firefox')+Key('c-t') ).execute()


will open a new tab in firefox.

good luck!


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] PumpMessages in main thread called by embedded Python causes crash

2012-04-29 Thread reckoner

Thanks for your reply.

Yes, the app works fine if I don't PumpMessages in my own code. There 
is no console that the application fires up when it runs the embedded 
Python code. In this situation, how do I (or, can I?) pump for my own 
messages if the application is doing some other kind of event loop, as 
you describe?


Thanks!



On Saturday, April 28, 2012 10:15:50 PM, Mark Hammond wrote:

I don't know why it crashes exactly, but if the other app has its own
event loop then things are going to get screwey - PumpMessages never
returns (well, not until a WM_QUIT message is received), so their event
loop will never run.

I'd guess that their event loop and event handlers have some assumptions
built in to it - eg, they might be assuming that their event loop as set
something up that one of the message handlers relies on.  You running
your own event loop will prevent that setup from happening so one of
their handlers will crash.

Does that app work OK if you don't call PumpMessages?  If so, a work
around might be to check if you have a console, and if you don't, assume
some other event loop must be running.

Mark

On 29/04/2012 2:21 AM, reckoner wrote:


I have written some code that catches windows events that also includes
the usual PumpMessages, and all of this works fine when I run it from
the Python interpreter (Python version 2.6). However, when a separate
application that has Python embedded calls the same code,  the calling
application crashes. I have tracked this down to the PumpMessages call
in my code.

My question is why does this work perfectly well from the interpreter,
but cause a crash when called from the embedded Python running in a
separate application. Note that I don't have access to the separate
application in which the Python call is embedded and when it crashes it
does not provide any kind of traceback.  It took a long time to narrow
it down to the PumpMessages call.

Any advice appreciated. I am really stuck here. By the way, this is on
Windows XP 32-bit.

Thanks!

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32




___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] PumpMessages in main thread called by embedded Python causes crash

2012-04-28 Thread reckoner


I have written some code that catches windows events that also includes 
the usual PumpMessages, and all of this works fine when I run it from 
the Python interpreter (Python version 2.6). However, when a separate 
application that has Python embedded calls the same code,  the calling 
application crashes. I have tracked this down to the PumpMessages call 
in my code.


My question is why does this work perfectly well from the interpreter, 
but cause a crash when called from the embedded Python running in a 
separate application. Note that I don't have access to the separate 
application in which the Python call is embedded and when it crashes it 
does not provide any kind of traceback.  It took a long time to narrow 
it down to the PumpMessages call.


Any advice appreciated. I am really stuck here. By the way, this is on 
Windows XP 32-bit.


Thanks!

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Need workaround for error: (299, 'GetModuleFileNameEx' with win32process

2012-03-21 Thread reckoner
when using win32process, I get the following error when I try this on a 
Windows XP 64-bit machine:



error: (299, 'GetModuleFileNameEx', 'Only part of a ReadProcessMemory or 
WriteProcessMemory request was completed.')


I don't get this error on a Windows XP 32-bit machine. After some 
drilling around, I found out that this is because I am using a 32-bit 
version of win32process to interrogate a 64-bit running application. 
Now, I have to support both 32 and 64-bit Windows XP systems, so I'm 
looking for a workaround for this. I am running the 32-bit version of 
Python on a 64-bit Windows XP system.


Any help appreciated. This is for Python version 2.6.2.

Thanks!



___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] When closing windows, how to handle save changes? dialogs?

2012-03-05 Thread reckoner
When closing windows,  I need to  somehow handle the case when the 
window I am trying to close  spawns a child dialog window that asks 
whether I want to save changes or something like that .  The trouble 
is that the dialog could be different for every kind of window I am 
trying to close and I would like to catch those in each case, and then 
later handle them separately. I just don't want to forcefully terminate 
the process in question, however.


Any help appreciated.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] How to wait for context menu (i.e. right-click menu) pop-up?

2011-10-26 Thread reckoner

Hi,

A script needs something on the context menu ( obtained either by 
right-click or by appskey ). The trouble is that sometimes the pop-up 
context menu takes an unpredictable time to load, so I need a way of 
detecting whether or not the context menu is ready for subsequent 
actions before the rest of the script can run.


Any way to do detect the availability of this context menu?

Thanks!
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Get executables corresponding to system tray icons?

2011-09-17 Thread reckoner

Hi,

Is there a way to use Python to get a list of all the icons in the 
system tray (lower right hand corner) and their associated processes and 
executables?


Here is a thread on how to do this using AHK:

   http://www.autohotkey.com/forum/topic17314.html

but it relies heavily on AHK, and the problem with that is that it is 
difficult to get at the output from AHK scripts (without writing to a 
file or the clipboard, for example).


Note that I'm interested this for in Windows XP/7

Thanks!
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Multiple versions of Python on same machine with regsvr32.exe PYDs

2011-07-18 Thread reckoner

Mark:

Thanks for your reply. I'm using the Python extension described here:

   http://www.synapseadaptive.com/joel/index_old.html

Basically, the natlink.pyd file is called ( after being registered with 
 regsvr32 ) indirectly by the speech recognition engine. Thus, if the 
natlink.pyd file is built using, say, Python version 2.6, and I have 
another version of Python installed, say, Python version 2.7, then when 
the functions inside of natlink.pyd are called, they need to somehow be 
able to figure out the correct Python path and other linked libraries. 
So, I'm not sure how this works in terms of the registry and how Python 
figures out which Python version it should use and where the 
corresponding libraries are.


Any ideas here? I would like to have multiple Python installations on 
the same machine so I can migrate between two versions, but I admit all 
of this registry stuff is confusing to me and I don't imagine it will be 
so simple as simply changing the Python path.


Thanks in advance and for all your great work bringing Python to us 
Windows users.





On 7/14/2011 9:24 PM, Mark Hammond wrote:

On 14/07/2011 4:39 AM, reckoner wrote:

Hi,

I have been researching this for a couple of days now, and although
virtualenv seems like the answer, I have been reading about problems
with applications that require specific versions of Python in the
registry so it can find corresponding PYD and DLL files. This means that
it is more complicated than just setting the path differently for each
Python installation.


I'm not with you there. What problems specifically?


In other words, if you need

c: regsrv32.exe Some_python.pyd


regsvr32.exe doesn't work with .pyd files - what were you hoping to
achieve?


then they're going to be problems if you try to change your default
Python installation by just manipulating the Path.

Basically, my problem is I need to slowly migrate my entire software
stack from Python version 2.6 to Python version 2.7.


What specific problems are you seeing?

Mark

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Multiple versions of Python on same machine with regsvr32.exe PYDs

2011-07-13 Thread reckoner

Hi,

I have been researching this for a couple of days now, and although 
virtualenv seems like the answer, I have been reading about problems 
with applications that require specific versions of Python in the 
registry so it can find corresponding PYD and DLL files. This means that 
it is more complicated than just setting the path differently for each 
Python installation.


In other words, if you need

c: regsrv32.exe Some_python.pyd

then they're going to be problems if you try to change your default 
Python installation by just manipulating the Path.


Basically, my problem is I need to slowly migrate my entire software 
stack from Python version 2.6 to Python version 2.7.


Any help appreciated.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Access Most Recently Used (MRU) entries ?

2011-06-18 Thread reckoner



On 17/06/2011 14:19, reckoner wrote:

Depends what you need to do. To add in item, use the SHAddToRecentDocs
API from the shell module:

code
import sys
from win32com.shell import shell, shellcon

shell.SHAddToRecentDocs (
shellcon.SHARD_PATHW,
sys.executable
)

/code

To access its contents (in file system terms):

code
import os, sys
from win32com.shell import shell, shellcon

mru = shell.SHGetSpecialFolderPath (0, shellcon.CSIDL_RECENT, 0)
print os.listdir (mru)

/code

To access it as shell folder:

code
import os, sys
from win32com.shell import shell, shellcon

mru_pidl = shell.SHGetSpecialFolderLocation (0, shellcon.CSIDL_RECENT)
desktop = shell.SHGetDesktopFolder ()
mru_folder = desktop.BindToObject (
mru_pidl,
None,
shell.IID_IShellFolder
)

for i in mru_folder:
print mru_folder.GetDisplayNameOf (i, shellcon.SHGDN_NORMAL)

/code

TJG



Thank you! This is a big help. Is there a way to find out which program 
called which item in the MRU list and when that occurred?


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Access Most Recently Used (MRU) entries ?

2011-06-17 Thread reckoner
Is it possible to get access to the Most Recently Used (MRU) list in 
windows. This is where Windows keeps a list of the most recently opened 
documents and programs.


By the way, I'm on Windows XP.

Thanks!

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Using Flexible Win32 message pump to monitor window open/close for all application?

2011-03-31 Thread reckoner




--

Message: 3
Date: Wed, 30 Mar 2011 16:17:01 -0700
From: Tim Robertst...@probo.com
To: Python-Win32 Listpython-win32@python.org
Subject: Re: [python-win32] Using Flexible Win32 message pump to
monitor window open/close for all application?
Message-ID:4d93b9ed.9010...@probo.com
Content-Type: text/plain; charset=ISO-8859-1

reckoner wrote:

Which is listed in the Python cookbook, second edition. Is it possible
to use this to monitor the open/close of different windows? Basically, I
would like to trigger an action for a specific window or handle when
that window class or handle opens/closes. Can this recipe help with
that? Any ideas on getting started with this?


Do you mean a window in another application?  That requires installing a
Windows hook, and a Windows hook callback must reside in a DLL (so that
DLL can be injected into the other process), which cannot be done in
Python.  There is the pyHook package, but I don't know if it is still
being developed.

http://www.cs.unc.edu/Research/assist/developer.shtml



Thanks your reply.

I'm guessing from your response that the cookbook recipe can only deal 
with open/close events that it throws itself. So far, the only way I 
have found to monitor window open/close events is the Active 
Accessibility (AA) layer via pyAA. The problem is that AA is really 
dated and is theoretically supposed to be superseded by the UI 
automation layer, but there are no similar Python bindings for that (and 
it relies on the .NET framework ).


Here is the link for a description of pyAA:

http://web.archive.org/web/20080510165211/mindtrove.info/articles/gui-automation-with-pyaa/


Thanks!



___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Using Flexible Win32 message pump to monitor window open/close for all application?

2011-03-30 Thread reckoner

Hi,

I have been looking at the following recipe:

Recipe 82236: Flexible Win32 message pump using 
MsgWaitForMultipleObjects (Python)

http://code.activestate.com/recipes/82236-flexible-win32-message-pump-using-msgwaitformultip

Which is listed in the Python cookbook, second edition. Is it possible 
to use this to monitor the open/close of different windows? Basically, I 
would like to trigger an action for a specific window or handle when 
that window class or handle opens/closes. Can this recipe help with 
that? Any ideas on getting started with this?


Thanks!


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Automation triggered based on image in window?

2011-02-18 Thread reckoner
I'm trying to do some automation using Python and pywin. Is there a way 
to trigger when a particular image is shown?


In other words, I am trying to get the functionality that is described here:

   http://www.vtaskstudio.com/images/screenshot_recognition.png

and likewise here:

   http://www.autohotkey.com/docs/commands/ImageSearch.htm

using Python tools.

Anybody know anything like this?
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Find containing window given a control handle

2011-02-01 Thread Reckoner
Hi,

Given the handle of a text field or button embedded in some window,
how can I find the parent window that contains the handle?

Right now, I'm exhaustively going through every visible window and
matching every child handle. Perhaps there is a better way?

Thanks!
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] make a window transparent using win32?

2010-12-30 Thread reckoner

Dear Tim:

by the way, quick question, do you know of a way to get the extended 
style bits? I haven't been able to find anything on MSDN. In other 
words, if I do as you suggest below for a few windows, how can I query 
those windows again to see if those bits that I previously set using 
SetWindowLong() are indeed set?


Thanks!

On 12/28/2010 1:44 PM, Tim Roberts wrote:

Reckoner wrote:

Using Python win32 extensions, how do you make an arbitrary window on
winXP transparent?


I'll assume you already know how to find the window handle of your
victim window.

The key concept is that you need to set the WS_EX_LAYERED bit in the
extended styles, then set the transparency level using
SetLayeredWindowAttributes.  You can look up both APIs in MSDN for more
detailed information.

 import win32gui
 import win32con
 win32gui.SetWindowLong(handle, win32con.GWL_EXSTYLE,
win32con.WS_EX_LAYERED)
 win32gui.SetLayeredWindowAttributes(handle, 0, 128, win32con.LWA_ALPHA)


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] make a window transparent using win32?

2010-12-28 Thread Reckoner
Using Python win32 extensions, how do you make an arbitrary window on
winXP transparent?

Thanks!
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Detecting when a system has multiple monitors (desktops)

2010-08-24 Thread reckoner

Tony:

All of this is handled in the dragonfly package:

http://code.google.com/p/dragonfly/

Note that you do not need speech recognition in order to use it. In 
particular, look at


   from dragonfly import Window, monitors


and the

window.py file in the distribution.

Good luck!



On 8/24/2010 4:33 PM, Tony Cappellini wrote:

Does anyone know how to detect if a system has multiple monitors
(desktops) through Python?

I've written a program which allows the user to open multiple
stand-alone windows.
When I run this program I usually drag these windows to my secondary monitor.

I was to save the screen coordinates of the window locations so they
can be restored.

First, the program must detect the multiple desktops and then
understand if the screen coordinates of those
windows are related to the primary or secondary desktop.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32