1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

New command or new ACTIVATE option request

Discussion in 'Suggestions' started by Steve Fabian, Mar 3, 2010.

  1. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    When a batch file needs to send keystrokes to a window, the only method
    now available is to use the ACTIVATE command, followed by the KEYSTACK
    command. However, if the batch file is executed by a background process, it
    is very easy for a different window to be activated from the desktop, or by
    another process, before KEYSTACK can deliver the keystrokes. To eliminate
    this problem, I'd like to have available a single command that can both
    ACTIVATE and deliver keystrokes. Whether this is a new command, or a new
    option for the existing ACTIVATE command is irrelevant.
    IIRC I had previously requested this feature, for like reasons.
    --
    Steve
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,726
    Likes Received:
    80
    Why do you think the behavior would be any different if it was one command
    instead of two?

    Rex Conn
    JP Software
     
  3. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    | ---Quote---
    || When a batch file needs to send keystrokes to a window, the only
    || method now available is to use the ACTIVATE command, followed by
    || the KEYSTACK command. However, if the batch file is executed by a
    || background process, it is very easy for a different window to be
    || activated from the desktop, or by another process, before KEYSTACK
    || can deliver the keystrokes. To eliminate this problem, I'd like to
    || have available a single command that can both ACTIVATE and deliver
    || keystrokes. Whether this is a new command, or a new
    || option for the existing ACTIVATE command is irrelevant.
    || IIRC I had previously requested this feature, for like reasons.
    | ---End Quote---
    | Why do you think the behavior would be any different if it was one
    | command instead of two?

    If the two tasks can be done in a single API call, definitely no opportunity
    would arise to steal focus. Even if separate API calls are required, the
    considerably less time between them would still reduce the probability that
    the focus would be stolen.
    --
    Steve
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,726
    Likes Received:
    80
    True, but for the lamentable fact that there is no API call to do that.
    More like 50+ API calls, and there wouldn't be any measurable difference in
    the time between them if it were one command versus two commands. And
    KEYSTACK has to wait between each keystroke for the console to signal that
    it's ready for another key, which is going to be 99% of the time spent.


    Nope -- see above.

    Rex Conn
    JP Software
     
  5. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    Is there any method to prevent stealing of the focus from the window which
    is supposed to receive emulated keystrokes from KEYSTACK?
     
  6. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,726
    Likes Received:
    80
    There's a registry setting that will prevent any background process from
    stealing the focus. But there's no way to prevent the user from doing it.

    Rex Conn
    JP Software
     

Share This Page