Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Extraneous control key presses generated by #or ! hotkeys!


  • Please log in to reply
82 replies to this topic
engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
I agree that if this can be made a directive (sort of like autotrim) where it has a default behavior then it cannot break existing scripts. Also, I think I can come up with a scenario where a lot of people could be affected: Google desktop. Google desktop has a mode where two presses of Control brings up a new window. I don't run it myself, but a lot of people do. I think it could interfere.

I also use Synergy to share my mouse and keyboard between two PCs at work (wonderful program), and I occasionally have the ctrl key stick on when switching between computers. I have not completely figured out what is going on, but I do have AHK scripts that send things running on both PCs. It may or may not be related to this topic, but I think it is possible.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
The current behavior sends only one Control keystroke (up+down), not two. In addition, the control keystroke is only sent when an Alt or Win key is being held down (i.e. the hotkey's modifier), and only for hook hotkeys.

Under these conditions, I don't see how a single control keystroke would cause a problem for the vast majority of systems because if it did, users would accidentally trigger those other programs whenever they pressed both Control and Alt at the same time (such as Ctrl-Alt-Delete, an OS hotkey, or to simulate AltGr).

If anyone still thinks this is a common problem that should be made a high priority, please provide better evidence such as a link to the program or script that causes a conflict, preferably along with the steps needed to reproduce the conflict.

In general, I don't wish to add directives to the program that would be used by fewer than 1% of users, let alone 0.1%. There's also the question of priorities as I said earlier.

Joy2DWorld
  • Members
  • 562 posts
  • Last active: Jun 30 2014 07:48 PM
  • Joined: 04 Dec 2006

The current behavior sends only one Control keystroke (up+down), not two.

Chris,

hopefully this is helpful. AHK is *wonderous*, purpose is helping make it even more so...

as is, AHK sends one Control keystroke EACH TIME A RELEVANT HOTKEY IS ACTIVATED!
so if more than one hotkey is used in succession, TWO (or more) EXTRANEOUS NAKED CONTROL KEYSTROKES GET GENERATED!!

In addition, the control keystroke is only sent when an Alt or Win key is being held down (i.e. the hotkey's modifier), and only for hook hotkeys.

actually, it's sent when the ALt or Win key is released,

and 'hook hotkeys' includes *EVERY* #IfWinActive hotkey.

the #IFWinActive is a great feature... useful, and USED A LOT...

then, ie. the control keystrokes are triggered.. A LOT..

I don't see how a single control keystroke would cause a problem for the vast majority of systems because if it did, users would accidentally trigger those other programs whenever they pressed both Control and Alt at the same time (such as Ctrl-Alt-Delete, an OS hotkey, or to simulate AltGr).

it requires a control with no other key being pressed. Ctrl-Alt combos don't trigger... but *AHK* does trigger because is sending a simulated control key press *when no other key is being pressed*.

If anyone still thinks this is a common problem that should be made a high priority, please provide better evidence such as a link to the program or script that causes a conflict, preferably along with the steps needed to reproduce the conflict.

Value is a measure of cost to benefit. Time in making the code change is the key cost... In this case... that (as far as am understanding) is MINIMAL.

n general, I don't wish to add directives to the program that would be used by fewer than 1% of users, let alone 0.1%..


a couple of more examples of real life conflicts:

in addition to the google double-control ...etc.:

Control Panel > Mouse > Pointer Options > check "Show location of pointer when I press the control key"

a very helpful option! (especially on my laptop)... press a naked control key and see a circle appear at the mouse caret. Works GREAT!... but unuseable for me as *every* one of my #IFWinActive winkey and alt hotkeys trigger the circle to annoyance.

or,

Ring2's auto dial feature, (control key activated) ( <!-- m -->http://www.ring2.com...news101205.html<!-- m --> )


and note: the issue was first noted in 2004, but without causing anyone bother... now-a-days, in current systems, this is problematic. It's not just me... jballi had problem and noted re: my first post on the #IfWInActive Alt control generation "This goes a long way to explain the "sometimes erratic" behavior I see when sending the Alt character."; also otlaolap noted problem, etc. ( <!-- m -->http://www.autohotke...topic22084.html<!-- m --> ).
Joyce Jamce

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

In addition, the control keystroke is only sent when an Alt or Win key is being held down (i.e. the hotkey's modifier), and only for hook hotkeys.

actually, it's sent when the ALt or Win key is released,

No, what you're seeing in KeyHistory is out of order -- it's an artifact caused by the recursive nature of the keyboard hook. If you examine the source, you will see that the Control keystroke is sent before the Win-up or Alt-up is allowed to be seen by other applications.

Therefore the control keystroke is sent immediately prior to the user's release of Alt or Win; that is, it's sent while Alt or Win are being held down -- at least from the point of view of all applications (the OS may be different because it has low-level handing of the Alt key).

it requires a control with no other key being pressed. Ctrl-Alt combos don't trigger... but *AHK* does trigger because is sending a simulated control key press *when no other key is being pressed*.

Not true, as explained above.

Value is a measure of cost to benefit. Time in making the code change is the key cost... In this case... that (as far as am understanding) is MINIMAL.

In this case, it's the added documentation complexity and code size that bothers me the most. It makes AutoHotkey seem overly complex to new users.

in addition to the google double-control ...etc.:

As stated earlier, AutoHotkey does not send a double control. So it shouldn't affect that application.

Control Panel > Mouse > Pointer Options > check "Show location of pointer when I press the control key"

a very helpful option! (especially on my laptop)... press a naked control key and see a circle appear at the mouse caret. Works GREAT!... but unuseable for me as *every* one of my #IFWinActive winkey and alt hotkeys trigger the circle to annoyance.

You may know that the animation appears when the control key is pressed for any reason, regardless of what other keys are being held down. Does this side-effect annoy anyone else enough to warrant a new option?

Ring2's auto dial feature, (control key activated) ( <!-- m -->http://www.ring2.com...news101205.html<!-- m --> )

Have you verified that a conflict actually occurs there? Due to the explanation higher above, it seems impossible unless that program traps keyboard events at the driver level.

It's not just me... jballi had problem and noted re: my first post on the #IfWinActive Alt control generation "This goes a long way to explain the "sometimes erratic" behavior I see when sending the Alt character."

I'd like to see more details of that erratic behavior: what applications it affects and the steps to reproduce it.

also otlaolap noted problem, etc. ( <!-- m -->http://www.autohotke...topic22084.html<!-- m --> ).

His concluding words there mirror my own attitude:

...the effects of any change are difficult to predict in the universe of all alt-key usages.

So I'll just work around it (already have) and not worry



Joy2DWorld
  • Members
  • 562 posts
  • Last active: Jun 30 2014 07:48 PM
  • Joined: 04 Dec 2006


No, what you're seeing in KeyHistory is out of order -- it's an artifact caused by the recursive nature of the keyboard hook. If you examine the source, you will see that the Control keystroke is sent before the Win-up or Alt-up is allowed to be seen by other applications.

Indeed saw that, but for whatever (system?) reasons, OTHER PROGRAMS, OTHER KEY LOGGERS, and for example the GOOGLE search, show the control upon RELEASE of the ALT/WIN key. If you activate the windows show mouse caret feature, you will see this also youself.

Therefore the control keystroke is sent immediately prior to the user's release of Alt or Win; that is, it's sent while Alt or Win are being held down -- at least from the point of view of all applications (the OS may be different because it has low-level handing of the Alt key).

but if you actually try it, you will see differently. My system is XPsp2, if i use two hotkeys #IFwinActive one and then move the mouse, and then the next, GOOGLE search pops up *upon the release of ALT key from second hotkey*, not upon key's press.

Chris, again, this is something you can easily see for youself.

In this case, it's the added documentation complexity and code size that bothers me the most. It makes AutoHotkey seem overly complex to new users.

Your documentation is at least half the amazing power of AHK. Fully agree with your concerns and thoughts on that, and note:

Explaining in at least a sentance somewhere about AHK sending Control keypress to avoid alt and Winkey menu callups is maybe worth including. One more sentence about #Dontsendphantomcontrolkeypresses seems more helpful than confusing, perhaps ?

As stated earlier, AutoHotkey does not send a double control. So it shouldn't affect that application.


either this is a systems dependent issue (some systems working different than others), or you haven't actually tried it. Set up the windows option to show mouse caret. Try a hooked hotkey... Set up a two simple ALT key hotkeys that do something other than send and are #IFWinActive hooked. Press one then the other... see if that triggers Google or not.. It certainly does on my system.

You may know that the animation appears when the control key is pressed for any reason, regardless of what other keys are being held down. Does this side-effect annoy anyone else enough to warrant a new option?


or my system is set up different from yours, or you haven't actually tried it ?? The animation appears on my system *ONLY* when the control key is pressed and released **WITHOUT ANY OTHER KEY BEING PRESSED**


final note:

a quick google for 'control key conflict' comes up with countless programs using control key as default trigger. An interesting example
<!-- m -->http://reilly.typepa... ... vewor.html<!-- m -->
tested, and indeed, the activeword program as shipped causes crazy interaction with AHK's phantom control key pressing.

and indeed, that program allows changingt the hotkey as in blog, *BUT* as in mine and likely other's cases, if distributing scripts to a few hundred machines to install or automate a program, cannot instruct each user to change other program's default settings so AHK will run with them!!!

ie. seems AHK would be a BETTER PROGRAM is it worked with programs such as that, even if they had control control set as their hotkey. AHK seems would be better if worked MORE UNIVERSALLY with LESS CONFLICTS CAUSED WITH OTHER PROGRAMS.

if you try even just the built in windows find cursor tool, you will see a huge conflict with the current coding of the #IFWinActive feature. Try it for a day and you will see. Since you *can* fix this... seems valuable to do

(from own perspective, the problem sadly makes AHK a non-starter for my students.. they have a langauge tool triggered by naked control keypress. AHK is so cool for many reasons, sure hope that will change!)
Joyce Jamce

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

if i use two hotkeys #IFwinActive one and then move the mouse, and then the next, GOOGLE search pops up *upon the release of ALT key from second hotkey*, not upon key's press.

The control keystroke is not sent upon press of the key, only immediately before it's release. Does anyone else have this problem with Google search? If so, I'd appreciate a link to the product and the steps to reproduce it.

The animation appears on my system *ONLY* when the control key is pressed and released **WITHOUT ANY OTHER KEY BEING PRESSED**

Yes, I see that now. I'd tested it with Control+Alt and the animation appeared in spite of pressing Alt with Control. Even so, it's a display issue that doesn't affect functionality.

As for apps that use a single press of the control key as their default activator, that's their decision. AutoHotkey's default behavior shouldn't be forced to change just because they decide the control key belongs to them.

Finally, the demanding tone of your posts (especially the earlier ones) has been a factor in my reluctance to add this feature. I generally don't respond well to such posts, especially when they repeat themselves as though the repetition somehow makes the case stronger. When/if others step forward to report the details of a conflict, I'll be willing to explore this further.

Joy2DWorld
  • Members
  • 562 posts
  • Last active: Jun 30 2014 07:48 PM
  • Joined: 04 Dec 2006

Finally, the demanding tone of your posts (especially the earlier ones) has been a factor in my reluctance to add this feature. I generally don't respond well to such posts, especially when they repeat themselves as though the repetition somehow makes the case stronger. When/if others step forward to report the details of a conflict, I'll be willing to explore this further.


Chris,


thanks for your openness and honesty, and think maybe you've taken my posts differently from the intent and spirit in which they have been made.

1. Personally really love what you've done with AHK. The free flow of the coding structure, the INCREDIBLE, USEABLE documentation make it a pleasure to use. Your own insights/directions with the base code, have clearly given birth to something both popularly useable (the very computerly unsophisticated can use it) and deeply powerful (a true programming language). (and this is not the first time I have posted the above sentiments.)

2. Any post i've ever made has been to help AHK become better. Will note that most all of my issues/suggestions that you've not necessarly taken to immediately at first in the past, have indeed been addressed (to benefit, i hope, of AHK/users/community).

3. Because I see in AHK a serious programming langauge, maybe my own personal frustration is higher when it 'acts up'. Would note that in working dilligently (and of course, saved by Sean's insights & direction), adding full (and powerful) DDE client functions to AHK, that I ran into 'AHK issues' that drove me crazy. (`n and \n equivolence as an example).

Without rambling, would just note that the DDE functions are just one live example of why from MY VIEW (others have expressed contrary), AHK is a *full* and legit programming langauge. Using just AHK, the functions perform more and faster than the built in windows DDEML dll. (and likely the code is no where near optimized).

anyhow, the control keypress fix is not some function I need for my own personal gratification, its something that is preventing me from spreading the coolness of AHK to others, and something directed very much to help improve and strengthen AHK.


4) Certainly did not intend multiple posts on "same" issue. My first post was about extraneous controls generated for ALT key sequences when #IfWinActive applied. You explained that this was for ALT keys, and to surpress Local window menus. (others noted in thread that discussion was helpful in understanding the behaviors they were seeing too).

so I shifted to Winkey activation, expecting to bypass the problem.... but... didn't work. controls also showing up with WINkey.

you didn't mention that, doc doesn't mention it... there are other ways known to block the start menu (as that is apparently the issue), so thought that might be unintenional and posted this thread.


there was not intent or attempt to multi-post the same issue


5) As a community myself and others, as happens likely daily in these forums, worked together, from different perspectives, and with each contributing his own bit of genius (ok, 2 bits from Sean), examined the issue deeper, and came up with a fix/solution.

hope that's something you enjoy, and support!!



6) hope you keep in mind that one of the powerful things that AHK can do, is be distributed via script or exe to users who know nothing of AHK, who are weary of 'new' or 'unknown or 'virus potential' 'suff', and to whom the scripts are meant to be a invisible hand, doing amazing things for them. Their entry door to AHK is blocked if they have to reconfigure other programs, or suddenly see cursors poping up on their screens.


if AHK can do something in a more NON-INTRUSIVE, elegant way, why not do it that way ?



finally,

gosh, if you find that my contributions are beneficial, and welcome them, my pleasure to keep making them as I can in the future. If you're reluctant to fix/make AHK better because of my contirbution to the issue, well, assure you that will never happen again.
Joyce Jamce

daonlyfreez
  • Members
  • 995 posts
  • Last active: Jan 23 2013 08:16 AM
  • Joined: 16 Mar 2005
:(

Please give the guy a break, he is one of the few (if not the only) active developer of AHK. Sure, once and a while an issue comes up, which looks like it is important and even easy to solve, but still: Chris will probably have to implement it all by himself.

So:

- Try to be as specific as possible
- Supply "hard evidence" (reproducable)
- If you have the knowledge, try adapting the source of AHK yourself

I understand it can be frustrating if an issue or wish is not granted immediately, but you can either help Chris resolve it, try fixing it yourself (AHK is open source), or run away from AHK alltogether. The latter is not useful at all, not for yourself, and neither for AHK.


:wink:
Posted Image mirror 1mirror 2mirror 3ahk4.me • PM or Posted Image

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
I believe that Chris was also asking for a link to the Google program for searching, so that he can try it. The program is Google Desktop Search - <!-- m -->http://desktop.google.com/<!-- m -->

I believe the default behavior of the program is to show a search box on double Ctrl press. If not, it is in the options to turn on. I can document this for you if needed.

Joy2DWorld
  • Members
  • 562 posts
  • Last active: Jun 30 2014 07:48 PM
  • Joined: 04 Dec 2006
here is a simple reproductive example of the conflict:
#IfWinActive Untitled

!i:: ; make color under cursor to be transparent
 {
	MouseGetPos, GCMouseX, GCMouseY
	PixelGetColor, myRGB, %GCMouseX%, %GCMouseY%, RGB
	WinSet, TransColor, %myRGB% , A
	return
} 

!j::  WinSet, TransColor,OFF , A

open a notepad, with cursor in notepad pane background press alt-I to see what is under notepad, then press alt-J to get back the notepad background. when you release the second ALT you see conflict. ie. external program sees as if two naked controls have been pressed
Joyce Jamce

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Thanks for the example. However, there are two reasons I think it occurs extremely rarely:
1) It requires that two hook+alt hotkeys be pressed, one after the other, without pressing any non-hotkey keys in between. In my opinion, this is extremely rare.
2) It requires software that apparently(?) pays no attention to the elapsed time between the first and second control keystroke. If Google Desktop reacts upon seeing the second control keystroke a long time after the first (minutes or hours even), that seems like poor design. It should respond to a double-press of the key at an interval similar to double-click (which is about half a second) -- not wait indefinitely for a second control keystroke.

Although it isn't the responsibility of AutoHotkey to work around poor design in other apps, it becomes important to me if it affects a significant percentage of users. Therefore, if anyone else has any conflict between AutoHotkey and Google Desktop (or any other app that uses the Control key), please post the details here.

Joy2DWorld
  • Members
  • 562 posts
  • Last active: Jun 30 2014 07:48 PM
  • Joined: 04 Dec 2006
1. #IfWinActive is a great feature and is used in majority of scripts intended for specific program/window ? yes ?

2. Alt and Winkey hotkeys are the most common form of hotkey ? yes ? Either Alt or Winkey hotkey generate the Control.. right ? (they do, if this is not clear, EVEN IF THEY ARE IN COMBINATION WITH ANOTHER MODIFIER.. ie. shift-Alt, control-alt, etc.. produce the control keypress).

3. There are many occasions when a pair of hotkeys is pressed within a very short time, a few which I use daily come to mind: (A) winkey-C and winkey V which i use for an 'internal cut an paste' off of clipboard in word (word clipboard issues using regular clipboard). often the win-C short cursor move win-V. Similar use likely as common. (B) use a win-T hotkey to cycle thru transparency levels of ACT!. usually need to press two or three to get the level I want. This seems also like a very common use of hotkeys... where such as setting sound or other level, (zoom, etc.) the hotkey often pressed a few times in rapid succession to get to the level desired. © win-shift-right which I use in word to move to end of paragraph. often move several paragraphs at a time.

4. It's easy to say that windows' show mouse caret postion, and google desktop search, etc. etc, are 'poorly written'... am not sure I personally agree with that, but not relevant. Am certain that adding the option to eliminate the AHK generated control key presses, (option suggested is 0xFF vkey up only for the alt, and if up only doesn't work for the Start Menu (am not sure on that either way), up/down 0xFF for winkey. possibly w/ lexikos' innovation of VK 0xFF, SC 0x05D and/or as in your expertise... to avoid the low-order byte of the scan code matching that of any other key on any keyboard layout/language, just in case.), causes no harm nor risk, is a tiny amount of effort (per this thread the solution has been explicitly presented, including which code sections), improves AHK and opens it to a wider userbase, and resolves known AHK conflicts with other programs/parts of the windows system-- 'whoever is to blame'.

5. Every AHK #IFWinActive Alt and Winkey hotkey, and every combination thereof, (including with/without shift, control), conflicts with the built in windows show mouse caret function. Ie. the conflict is with every single keypress, not multiples, etc. is with Windows itself, not some 3rd party software. You can easily add the option developed in this thread to remove the conflict.


if you're looking at this with an open mind, my efforts here, I hope, will be helpful.
Joyce Jamce

Superfraggle
  • Members
  • 1019 posts
  • Last active: Sep 25 2011 01:06 AM
  • Joined: 02 Nov 2004

here is a simple reproductive example of the conflict:

#IfWinActive Untitled

!i:: ; make color under cursor to be transparent
 {
	MouseGetPos, GCMouseX, GCMouseY
	PixelGetColor, myRGB, %GCMouseX%, %GCMouseY%, RGB
	WinSet, TransColor, %myRGB% , A
	return
} 

!j::  WinSet, TransColor,OFF , A

open a notepad, with cursor in notepad pane background press alt-I to see what is under notepad, then press alt-J to get back the notepad background. when you release the second ALT you see conflict. ie. external program sees as if two naked controls have been pressed


I have to say I have google desktop and tried replicating the issue, no matter how quickly i pressed the keys I did not have this trouble at all.
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle

Joy2DWorld
  • Members
  • 562 posts
  • Last active: Jun 30 2014 07:48 PM
  • Joined: 04 Dec 2006

I have to say I have google desktop and tried replicating the issue, no matter how quickly i pressed the keys I did not have this trouble at all.

maybe a silly question, but you have the new version and control-control search turned on ?

(also may have to with order of load AHK/google).

note, you do not have to press them so fast.. key one... boop... key two works just fine..

and finally, if you activate the windows control key to show cursor, do you see that when you try the example ?
Joyce Jamce

Superfraggle
  • Members
  • 1019 posts
  • Last active: Sep 25 2011 01:06 AM
  • Joined: 02 Nov 2004
Pressing control - control brings up the big google search box in the center of the screen, I am using Google Desktop 5.1.0706.29690-en-GB-pb

Mine should be the latest version, I have google updater installed, which should keep it up to date.

I tried the script pressing the keys both in quick sucession and slowly, and neither of them produced the search box. (I tried several times with several speed differences between. ) I have yet been able to reproduce.

I have also tried loading each one first, still makes no difference,


EDIT:: I am able to get the windows show cursor tool to flash when pressing the keys, but still no sign of the desktop search window from any of the above.
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle