^+c send {Alt}, and physical press the {Alt}, the behavior is different problem Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
pk23
Posts: 110
Joined: 24 Apr 2015, 00:49

^+c send {Alt}, and physical press the {Alt}, the behavior is different problem

10 Apr 2017, 17:42

When we click the Alt key in the Win program, such as Notepad, the menu can be activated. As shown:
Image

But through the following code, we can not activate the menu: Why?

Code: Select all

^+c :: Send {Alt}
Tried:
① I Googled "ctrl send alt AutoHotkey", did not find the answer
② Try sendplay sendevent, not working too
③ Try #UseHook, not working
④ Try BlockInput to shield the impact of ctrl and shift, not work:

Code: Select all

^+c ::
BlockInput, On
Send {Ctrl Up}{Shift Up}{c Up}
Sleep 50
Send {Alt}
BlockInput, Off
Return
Although this problem has been solved in the following way:

Code: Select all

^+c :: Send {LAlt Down} ef {LAlt Up}
But what make me curious is the reason behind:
  1. what cause the difference between Send {Alt} and pressing the Alt key using hand? Windows API RegisterHotkey() don't support it?
  2. How does AutoHotkey activate the response of the menu bar in the GIF shows?
Thanks :)
bigdeal
Posts: 66
Joined: 13 Feb 2017, 06:31

Re: ^+c send {Alt}, and physical press the {Alt}, the behavior is different problem  Topic is solved

10 Apr 2017, 17:53

this should work:

^+c::
KeyWait Control
KeyWait Shift
Send {Alt}
return
pk23
Posts: 110
Joined: 24 Apr 2015, 00:49

Re: ^+c send {Alt}, and physical press the {Alt}, the behavior is different problem

10 Apr 2017, 18:02

bigdeal wrote:this should work:

^+c::
KeyWait Control
KeyWait Shift
Send {Alt}
return
Concise and elegant answer. Thank you so much! :bravo:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: bobstoner289, peter_ahk, Spawnova and 353 guests