[python-win32] Bringing an external initiated/called window to foreground/focus?

Jacob Kruger jacob at blindza.co.za
Wed Mar 19 16:31:19 CET 2014


Perfect!

Only issue will be varying possibilities of titles for windows explorer window, but, can work around that.

Thanks

Jacob Kruger
Blind Biker
Skype: BlindZA
"Roger Wilco wants to welcome you...to the space janitor's closet..."

  ----- Original Message ----- 
  From: Jim Bell 
  To: Jacob Kruger ; python-win32 
  Sent: Wednesday, 19 March, 2014 1:50 PM
  Subject: Re: [python-win32] Bringing an external initiated/called window to foreground/focus?


  Find and activate it by matching its window title.

  import win32com.client
  shell = win32com.client.Dispatch('WScript.Shell')
  if shell.AppActivate('Explorer'): # put a better match here.
     print 'Did it.'



  On 2014-03-19 5:32 AM, Jacob Kruger wrote:

    If, for example, I use something like following command line call/command to launch an instance of windows explorer, in a specific location, with a specific file highlighted/selected, the issue is that it seems to, possibly be hovering in background/not actually taking focus on my windows7 64 bit machine:

    explorer /select,c:\temp\testFile.txt

    Wondering if there's a relatively simple way to bring a specific, external window/application into foreground focus?

    TIA

    Jacob Kruger
    Blind Biker
    Skype: BlindZA
    "Roger Wilco wants to welcome you...to the space janitor's closet..."


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20140319/b71c99c9/attachment.html>


More information about the python-win32 mailing list