[python-win32] Finding the selected file in Windows Explorer

Larry Bates larry.bates at websafe.com
Tue Apr 22 16:02:52 CEST 2008


Daniel Gonçalves wrote:
> Hi!
> 
> I need to find the selected file(s) in a Windows Explorer window from
> another program (I'd look at the window that last had focus). I found
> something in the following page that should do the trick:
> 
> http://blogs.msdn.com/oldnewthing/archive/2004/07/20/188696.aspx
> 
> However, it is not Python and, while I'm a competent Python
> programmer, Win32, COM and the like are somewhat outside my
> competences.
> 
> Does any one know how to do something similar in Python (maybe in a more 
> Pythonic way?)
> 
> 
> Tks!
> Daniel Gonçalves

Daniel,

What do you mean by "find the selected files".  Give us a little more
detail about your use case and we can help.

One way of knowing about files that are selected is this:

If you selected several files and drag and drop them on a python program the 
files that are selected will be passed into the program in sys.argv.  I don't 
know if that is what you are looking for or not.

-Larry



More information about the python-win32 mailing list