- This topic has 1 reply, 2 voices, and was last updated 5 years, 5 months ago by
January 27, 2015 at 12:40 pm #22189ParticipantTopics: 5Replies: 4Points: 0Rank: Member
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
January 27, 2015 at 12:58 pm #22190ParticipantTopics: 4Replies: 262Points: 61Rank: Member
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?
- The topic ‘Send Key Question’ is closed to new replies.