Send Key Question

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Tim Pringle Tim Pringle 1 year, 10 months ago.

  • Author
    Posts
  • #22189
    Profile photo of Vincent Morris
    Vincent Morris
    Participant

    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
    Profile photo of Tim Pringle
    Tim Pringle
    Participant

    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. [url]https://powershell.org/forums/topic/sendkeys/[/url]
    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. [url]https://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys%28v=vs.110%29.aspx[/url]

    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?

You must be logged in to reply to this topic.