AutoHotkey Community

It is currently May 27th, 2012, 7:04 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: March 12th, 2006, 3:41 pm 
Offline

Joined: November 26th, 2004, 8:31 am
Posts: 21
I am trying to get {Win} to work just like {Shift} and {Ctrl} - to act as a "real" modifier, one which only changes the meaning of other pressed keys, but when pressed separatelly, does nothing at all. Specifically, I want to disable activating Start Menu with a {Win}-press, but I want to keep {Win + key} hotkeys. I tried several ways to do it but I can't find any that works:

1) The first idea I had was to use {LWin} to set a custom variable windows_key_is_pressed := 1, then "eat" the key so the other applications don't know about it. With {LWin UP} I would set the variable to 0. Inan "any key" handler I would check if windows_key_is_pressed is 1, in which case I would eat the key and send {LWin}{the key}{LWin UP}. The problem is that there doesn't seem to be any way to respond to "any key".

2) Then I thought about creating a hotstring that would replace {LWin}{LWin UP} with nothing. Again, this doesn't seem to be supported.

I am at a loss what to try now. Any pointers would be appreciated.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2006, 2:34 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
There may be easier/better ways to do this, but here's one way that seems to work:
Code:
LWin & z::MsgBox Win+Z.
LWin::return

This relies on the fact that when LWin is used as a prefix key (i.e. the first hotkey above), any subseqent use of LWin as a naked hotkey will fire upon release of LWin. So the above script causes the release of LWin to be blocked (hidden from the system), which prevents the Start Menu from appearing.

In case that one gives you any problems, here's another way. But I don't really trust it because in theory, it shouldn't work (even though in practice, it does):
Code:
~LWin up::Send {Blind}{Ctrl}
#z::MsgBox Win+Z.

This relies on the fact that a Control keystroke "disguises" your release of the LWin key, which prevents the OS from displaying the Start Menu. The reason it shouldn't work is that the Control keystroke comes too late: it's supposed to occur before you release LWin.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2006, 7:24 am 
Offline

Joined: November 26th, 2004, 8:31 am
Posts: 21
The first method has the obvious drawback that I would have to recreate Windows native Win+## combinations, some of which might be somewhat difficult to do (Win+R). I'll try the second method.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2006, 8:37 am 
Offline

Joined: November 26th, 2004, 8:31 am
Posts: 21
Actually, that BLIND trick seems to be a perfect solution and in fact works exactly as it should - I have just tried out that the sequence Win DOWN, Ctrl DOWN, Ctrl UP, Win UP really prevents the Start Menu from appearing, and that hotkey pretty much simulates this sequence. I like it!

Still, it might be worth putting

1) "any key" hotkey, with a variable such as A_AnyKey containing the pressed key

2) Modifier-press as a separate hotkey ({LWin PRESS})

into the todo list.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2006, 10:45 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
pepak wrote:
The first method has the obvious drawback that I would have to recreate Windows native Win+## combinations
Did you actually try the first example? On my system, it doesn't interfere with Explorer hotkeys such as Win+E and Win+R.

Quote:
"any key" hotkey, with a variable such as A_AnyKey containing the pressed key
Although that probably won't be implemented, an OnKeystroke facility is planned that is similar to the Input command in capabilities. OnKeystroke was proposed and discussed in another topic.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2006, 9:38 pm 
Offline

Joined: November 26th, 2004, 8:31 am
Posts: 21
Chris wrote:
pepak wrote:
The first method has the obvious drawback that I would have to recreate Windows native Win+## combinations
Did you actually try the first example? On my system, it doesn't interfere with Explorer hotkeys such as Win+E and Win+R.

Yes, I tried. It doesn't work on my system - all hotkeys with LWin are rendered inoperative.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot], migz99, sjc1000, Yahoo [Bot] and 73 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group