Send Key Question

Welcome Forums General PowerShell Q&A Send Key Question

Viewing 1 reply thread
  • Author
    Posts
    • #22189
      Participant
      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

      Thanks,
      Vincent

    • #22190
      Participant
      Topics: 4
      Replies: 262
      Points: 61
      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. https://powershell.org/forums/topic/sendkeys/
      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. https://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys%28v=vs.110%29.aspx

      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?

Viewing 1 reply thread
  • The topic ‘Send Key Question’ is closed to new replies.