Re: SendKeys and Python 2.7

Discussion in 'Python' started by Michel Claveau - MVP, Sep 13, 2010.

  1. Re!

    Sorry for time, but I am very busy...


    With Python + Pywin32, you can force the activation of a window (before
    send some keys...)
    See:
    win32gui.SetForegroundWindow(w_handle)

    or
    win32gui.SetActiveWindow(w_handle)



    For to find a windows (and his handle), see:
    win32gui.EnumWindows()
    win32gui.GetWindowTex()
    or
    win32gui.FindWindowEx()


    @-salutations
    --
    Michel Claveau
     
    Michel Claveau - MVP, Sep 13, 2010
    #1
    1. Advertising

  2. > On Mon, Sep 13, 2010 at 4:02 PM, Michel Claveau - MVP
    > <> wrote:
    >> Sorry for time, but I am very busy...
    >>
    >> With Python + Pywin32, you can force the activation of a window (before
    >> send some keys...)
    >> See:
    >>  win32gui.SetForegroundWindow(w_handle)
    >>
    >> or
    >>  win32gui.SetActiveWindow(w_handle)
    >>
    >>
    >>
    >> For to find a windows (and his handle), see:
    >>  win32gui.EnumWindows()
    >>  win32gui.GetWindowTex()
    >> or
    >>  win32gui.FindWindowEx()


    I ended up using Dispatch("WScript.Shell") and AppActivate("R
    Console") of the win32com.client module because they are higher level
    functions. I guess that your code runs faster, but I don't have an old
    machine to compare the performance of the two codes. I still may
    switch to your code in the future, when I have easy access to a real
    machine running Windows to make some tests. The released version of
    the plugin is here:
    http://www.vim.org/scripts/script.php?script_id=2628

    Thanks for your help!

    Jakson Aquino
     
    Jakson A. Aquino, Sep 18, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike John

    How do I sendkeys

    Mike John, Jul 7, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    497
    Mike John
    Jul 7, 2003
  2. oyster
    Replies:
    0
    Views:
    543
    oyster
    Aug 10, 2010
  3. Albert Hopkins

    Re: SendKeys and Python 2.7

    Albert Hopkins, Sep 9, 2010, in forum: Python
    Replies:
    0
    Views:
    430
    Albert Hopkins
    Sep 9, 2010
  4. Michel Claveau - MVP

    Re: SendKeys and Python 2.7

    Michel Claveau - MVP, Sep 9, 2010, in forum: Python
    Replies:
    7
    Views:
    3,219
    Lawrence D'Oliveiro
    Sep 11, 2010
  5. Jakson A. Aquino

    Re: SendKeys and Python 2.7

    Jakson A. Aquino, Sep 10, 2010, in forum: Python
    Replies:
    3
    Views:
    654
    Lawrence D'Oliveiro
    Sep 11, 2010
Loading...

Share This Page