Send Key Question

Welcome Forums General PowerShell Q&A Send Key Question

This topic contains 1 reply, has 2 voices, and was last updated by

4 years, 5 months ago.

  • Author
  • #22189

    Topics: 5
    Replies: 4
    Points: 0
    Rank: Member

    Hey Guys,

    Is it possible to use send Key to do the following things, if so, How?

    Press the windows key

    Press a combination with the windows key

    Left click/right click

    Left click/right click specific coords


  • #22190

    Topics: 4
    Replies: 262
    Points: 60
    Rank: Member

    Hi Vincent,

    It's possible to use send keys for the first two operations you describe. Take a look at the thread on this forum for some examples.
    For the third....hmm depending on your operating system, it may also be possible to use your NumberLock keys, but this can be pretty specific. In other circumstances you would probably need to enable the Ease of Access to specifically use the keyboard.
    For fourth, not certain on specific coords, and bear in mind these will always be relative to the screen resolution. As such you'll never be able to ensure you're actually clicking on the right location. You could use SendKeys in combination with some API functions to try and activate the specific window, and then activate the specific control before using SendKeys to simulate the click.

    You can get additional information about SendKeys, take a look at the MSDN article, which describes the keyboard combinations.

    Really though, SendKeys should be the last option you choose, you lose control of what's happening and have just got to hope it's going to work.

    What's the intended purpose?

The topic ‘Send Key Question’ is closed to new replies.