Disable left windows key on Windows 11 with AHK 2 beta 3

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
micktg99
Posts: 12
Joined: 08 Apr 2020, 05:44

Disable left windows key on Windows 11 with AHK 2 beta 3

12 Nov 2021, 04:58

Hello guys,

I have just updated AHK to v2 beta 3 and migrated my script to the new syntax. I managed to make almost everything work, but there is one command, that does not work like it does in AHK 1.
I want to ignore a single Windows key press to prevent opening the windows search bar. In AHK 1 it worked with the following command:

Code: Select all

; Prevent windows menu on windows key (does not work in ahk 2 beta 3).
LWin::
{
    ; MsgBox "Windows key pressed."                              ; Just to test if the key press is recognized
    ; Send "{SC058}"                                             ; Search bar still opens
    ; Send "{Blind}^{Click Left}"                              	 ; Search bar still opens
    return
}    
It has worked in Win11 with AHK 1, so I assume Windows 11 is not the the problem. With AHK 2 beta 3 the shortcut gets recognized but the Windows search bar still opens.
I tried a few things as you can see in the comments, but anything I did, the search bar still opens. Any ideas how to make it work in AHK 2 beta 3. Thanks!

By the way, I have no difficulty using the left Windows key in combination with other key like s (e.g. win + s to save document). In that case, no search bar pops up. It is just the single Windows key press.
The use case is the following. Sometimes I want to press a key combination like win + s, and I have already pressed the Windows key, but then I changed my mind and want to make something different. So I left the Windows key and then the search bar displays (which I do not want)

Regards
Michael
lexikos
Posts: 9780
Joined: 30 Sep 2013, 04:07
Contact:

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

13 Nov 2021, 04:24

I do not see how it could behave differently between v1 and v2. In both versions, the LWin key-down and key-up events are suppressed and no other action is taken.

There are some cases where the system detects and reacts to keys before passing them to the keyboard hook (i.e. "suppressing" the events is inadequate because the system has already acted on them), but LWin is not one of them on Windows 10. Perhaps Windows 11 handles the Win keys differently than Windows 10.

Why did you choose SC058? That's generally F12. In any case, sending F12 or Ctrl (in ^{Click Left}) would have been sufficient to suppress a window menu or Start menu on Windows 10 and earlier. Clicking the mouse alone is not sufficient. Neither is sending a key that has no corresponding virtual keycode (not an issue for SC058 on standard layouts). If the LWin key was not already being blocked, I would generally send a VK code that has no effect, like {Blind}{vkE8}.

I do not have Windows 11 yet to test.
micktg99
Posts: 12
Joined: 08 Apr 2020, 05:44

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

13 Nov 2021, 12:41

lexikos wrote: I do not see how it could behave differently between v1 and v2. In both versions, the LWin key-down and key-up events are suppressed and no other action is taken.
I thought so too, but if I open the script with v2 the Win11 search bar opens. If I open the same script with v1.x nothing happens (as I wanted it to be). So there is definitely a difference.
Maybe I can help if I offer some debug logs or other data, that might be useful for the devs.
lexikos wrote: Why did you choose SC058? That's generally F12. In any case, sending F12 or Ctrl (in ^{Click Left}) would have been sufficient to suppress a window menu or Start menu on Windows 10 and earlier. Clicking the mouse alone is not sufficient. Neither is sending a key that has no corresponding virtual keycode (not an issue for SC058 on standard layouts). If the LWin key was not already being blocked, I would generally send a VK code that has no effect, like {Blind}{vkE8}.
If choose SC058 or F12 just for testing purposes. With the F12 key pressed, nothing happened in Win11 on the desktop, so I just chose this key. By the way, if execute the following:

Code: Select all

LWin::
{
    MsgBox "Windows key pressed."                              ; Just to test if the key press is recognized
    return
}
The message box is displayed correctly, but the search bar still opens. This does not happen with v1 either.
lexikos wrote: I do not have Windows 11 yet to test.
As I said, if I can be helpful, let me know.
User avatar
Ragnar
Posts: 764
Joined: 30 Sep 2013, 15:25

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

13 Nov 2021, 14:12

I'm using Windows 11 (Pro, 22000.318), but I can't confirm that the Windows search bar opens when I press this hotkey - only the message box is displayed. Are you sure you don't have another script or something similar running that could be interfering?
micktg99
Posts: 12
Joined: 08 Apr 2020, 05:44

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

14 Nov 2021, 03:19

Ragnar wrote: I'm using Windows 11 (Pro, 22000.318), but I can't confirm that the Windows search bar opens when I press this hotkey - only the message box is displayed. Are you sure you don't have another script or something similar running that could be interfering?
Indeed. The presented snippet is just part of a larger script.
I would not have expected that another statement could interfere with this, as it was not the case in v1 with this script. I will comment out the other statements in my script and then re-enable them one by one to see which other statement interferes.
Thanks for your input.
I'll get back to you as soon as I know more.
micktg99
Posts: 12
Joined: 08 Apr 2020, 05:44

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

14 Nov 2021, 07:15

I have performed a few tests and can report the following.
If my script looks like this

Code: Select all

; Encoding: UTF-8 mit BOM

; Prevent windows menu on windows key.
LWin::
{
    return
}
The Windows key press is suppressed as it should be, but if I have a similar command in the script, then the single press is not suppressed

Code: Select all

; Encoding: UTF-8 mit BOM

; Prevent windows menu on windows key.
LWin::
{
    return
}

LWin & Q::{
    MsgBox "LWin & Q."
}
The shortcut LWin & Q works as intended, but if I press only the Win key, the search bar still opens. This does not happen in v1, and I am not sure why it happens in v2 beta. AHK recognizes the trigger correctly in the second script (can be seen if we put another message box in there.) But the windows search bar still open.
Maybe I miss something, that has changed in v2 or this behavior is not as it should be.


I also have another weird behavior, that might have something to do with this.
I want to map the windows snap feature in window from win + left to win + option + left like this

Code: Select all

; Encoding: UTF-8 mit BOM

; Snap window to left side
!#Left:: ; alt/option + win + left
{
    ; MsgBox "!#Left"
    Send "#{Left}" ; win # left
}
If I execute the shortcut, nothing happens. But if I enable the message box. The shortcut gets recognized (the message box opens) and the windows does snap now. So the window snapping does not happen if I disable the message box.

I want to apologize if I am doing something completely stupid here. But this has all worked in v1 and I just want to call attention to that.
lexikos
Posts: 9780
Joined: 30 Sep 2013, 04:07
Contact:

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

15 Nov 2021, 07:18

The first issue is likely due to the following change:
Hotkeys now mask the Win/Alt key on release only if it is logically down and the hotkey requires the Win/Alt key (with #/! or a custom prefix). That is, hotkeys which do not require the Win/Alt key no longer mask Win/Alt-up when the Win/Alt key is physically down. This allows hotkeys which send {Blind}{LWin up} to activate the Start menu (which was already possible if using a remapped key such as AppsKey::RWin).
Source: Changes from v1.1 | AutoHotkey v2
It is easier to take action in script than it is to work around unwanted actions that are taken automatically.

Code: Select all

~LWin::Send "{Blind}{vkE8}"

The first difference in behaviour between having or not having LWin & Q:: is that the keyboard hook is designed to never suppress the prefix key in a custom combination if it is a standard modifier key, probably because:
  • Unlike custom modifiers like Tab in Tab & Q::, the standard modifier keys are already designed to cancel out their native function when they are used in combination with another key, so do not need to be completely suppressed.
  • Most users wouldn't expect a hotkey like LWin & Q:: to implicitly disable all of the native functions of LWin (and combinations which include it).

The second difference in behaviour is due to this rule:
Fire on release: The presence of one of the above custom combination hotkeys causes the release of Numpad0 to perform the indicated action, but only if you did not press any other keys while Numpad0 was being held down. This behaviour can be avoided by applying the tilde prefix to either hotkey.
Source: Hotkeys - Definition & Usage | AutoHotkey v2
On a related note, a technique similar to [using the up suffix] is to make a hotkey into a prefix key. The advantage is that although the hotkey will fire upon release, it will do so only if you did not press any other key while it was held down. For example:

Code: Select all

LControl & F1::return  ; Make left-control a prefix by using it in front of "&" at least once.
LControl::MsgBox "You released LControl without having used it to modify any other key."
Source: Hotkeys - Definition & Usage | AutoHotkey v2
Attempting to mask LWin by sending a keystroke after it is released doesn't work very well, although on Windows 10 it might cancel out the menu with some brief flicker.


So to be clear:
  • LWin:: on its own fires on key-down and suppresses it, not only suppressing the Start menu but also preventing any use of LWin as a modifier in standard system hotkeys.
  • Once LWin & Q:: is added to the script, LWin:: fires on key-up and does not block key-down/up. Since it isn't blocked, it can be used in standard system hotkeys, and may trigger the Start menu if no other keys are pressed or sent before it is released.
    • v1 automatically masks the release of LWin when LWin:: fires, because LWin is both physically and logically down; the actual hotkey is not taken into account.
    • v2 does not automatically mask the release of LWin, because LWin:: does not "require" LWin (that is, LWin is not a prerequisite modifier of the hotkey; the key is not considered to modify itself).
I will consider how this can be improved.


Personally, I would not use the custom combination syntax to define combinations that aren't custom.
For standard modifier keys, normal hotkeys typically work as well or better than "custom" combinations. For example, <+s:: is recommended over LShift & s::.
However, <#Q:: affects the behaviour of LWin:: in the same way. It was probably assumed that the user would still want to use LWin to activate <#Q::. If LWin is suppressed, the only way to activate <#Q:: would be via remapping (xxx::LWin).

On the other hand, the current behaviour makes it very difficult to suppress LWin:: when <#Q:: is also present. I'm currently wondering why I haven't changed LWin:: to always suppress, since ~LWin:: can and should be used if suppression isn't desired, but it's late here; I'm tired and might be forgetting something.
lexikos
Posts: 9780
Joined: 30 Sep 2013, 04:07
Contact:

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

15 Nov 2021, 16:49

micktg99 wrote:
14 Nov 2021, 07:15
If I execute the shortcut, nothing happens. But if I enable the message box. The shortcut gets recognized (the message box opens) and the windows does snap now. So the window snapping does not happen if I disable the message box.
This is unrelated. There are two ways to reproduce it in v1:
  • Use SendMode Input
  • Use SetKeyDelay -1, 0
SendInput is the default in v2 (or if you use the v1 default script template). In this mode, there are no delays. If multiple scripts are running with keyboard hooks, this falls back to SendEvent mode with delays as above. It is not the mode that matters, but the timing.

If you use MsgBox, you will most likely not be holding any keys when you dismiss the box. Send will therefore not need to temporarily release the Alt key. Releasing the Alt key requires sending the mask key, since pressing and releasing Alt (even while holding R/LWin) usually activates the window menu. Adding KeyWait "Alt" might also work.

With some versions of the hotkey, Windows will put the window back in the centre but will still show the Snap Assist UI, as though the window has been snapped to the side. Snap Assist is not shown reliably even when it should be.
micktg99
Posts: 12
Joined: 08 Apr 2020, 05:44

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

16 Nov 2021, 07:55

So first of all let me thank you for your detailed answer.
I am not sure if I understood everything you wrote, but I have worked some things out, that I can use as a workaround.

If I use

Code: Select all

; Prevent windows menu on windows key press.
~LWin::Send "{Blind}{vkE8}"                                 ; do nothing
The windows menu popup is suppressed and other hotkeys with the win key involved still work like

Code: Select all

; 2 key shortcuts
#n::Send "^n"                                               ; Open new window.              win + n                         ->      ctrl + s
#w::Send "^w"                                               ; close tab
#f::Send "^f"                                               ; find
#r::Send "^r"                                               ; reload
#a::Send "^a"                                               ; mark all
#d::Send "^d"                                               ; create favorite in browser
#x::Send "^x"                                               ; cut
#c::Send "^c"                                               ; copy
#v::Send "^v"                                               ; paste, insert
#s::Send "^s"                                               ; Safe file.                    win + s                         ->      ctrl + s
#t::Send "^t"                                               ; open tab                      win + t                         ->      ctrl + t
#h::Send "!{Esc}"                                           ; Minimize window (faking it by moving the current window behind all others)                    win + h                         ->      alt/option + ESC
#q::Send "!{f4}"                                            ; quit                          win + q                         ->      alt/option + f4
#z::Send "^z"                                               ; undo                          win + z                         ->      ctrl + z
#Enter::Send "^{Enter}"                                     ; enter, new page in gdocs
#NumpadAdd::Send "^{+}"                                     ; zoom in mit numpad (pdf)
#NumpadSub::Send "^-"                                       ; zoom out mit numpad (pdf)
#SC01B::Send "^{+}"                                         ; zoom in (pdf)
#-::Send "^-"                                               ; zoom out (pdf)
#0::Send "^0"                                               ; zoom reset (pdf)
#LButton::Send "{Blind}^{Click Left}"                       ; Win + Left Mouse Button, Blind prevents windows menu opening
#RButton::Send "{Blind}^{Click Right}"                      ; Win + Right Mouse Button, Blind prevents windows menu opening


; 3 key shortcuts
#!s::Send "#s"                                              ; Open windows search           win + alt/option + s            ->      win + s
#+n::Send "^+n"                                             ; Create new folder             win + shift + n                 ->      ctrl + shift + s
#+t::Send "^+t"                                             ; Reopen last closed tab        win + shift + t                 ->      ctrl + shift + t
#+z::Send "^y"                                              ; redo                          win + shift + z                 ->      ctrl + y
#+4::Send "#+s"                                             ; Open screenshot box           win + shift + 4                 ->      win + shift + s
#^q::DllCall("LockWorkStation")                             ; Lock workstation              win + ctrl + q                  ->      System call
So that's great!

My problem with the windows snapping is also solved (well, almost)

Based on your suggestions, I added the following commands to the script.

Code: Select all

SendMode "Input"
SetKeyDelay -1, 0


; --------------------------------------------------------------------------------------------------
; Window snapping
; --------------------------------------------------------------------------------------------------

; Snap window to left side
#!Left:: ; alt/option + win + left
{
    ; MsgBox "!#Left"
    KeyWait "Alt"
    Send "#{Left}" ; win + left
}


; Snap window to right side
#!Right:: ; alt/option + win + right
{
    KeyWait "Alt"
    Send "#{Right}" ; win # right
}


; Window fullscreen
#!Up:: ; alt/option + win + up
{
    KeyWait "Alt"
    Send "#{Up}" ; win # up
}


; Window fullscreen
#!f:: ; alt/option + win + f
{
    KeyWait "Alt"
    Send "#{Up}" ; win # up
}
This works, but only if I release the alt/option + win keys (which is totally ok for me. I just have to get used to it)
Usually I hold alt/option + win and the press on of the arrows keys (left or right). If I do that, nothing happens, but if I release alt/option + win together, then the command gets fired.

Once again, this is totally fine, and I am thankful for your suggestions!
lexikos
Posts: 9780
Joined: 30 Sep 2013, 04:07
Contact:

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

19 Nov 2021, 03:27

For Snap, just use SendEvent instead of Send. No need for KeyWait. That was just to show why MsgBox helped.
micktg99
Posts: 12
Joined: 08 Apr 2020, 05:44

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

19 Nov 2021, 08:50

Ah, ok, I see what was the problem.
It was not working when I had

Code: Select all

SendMode "Input"
and

Code: Select all

SetKeyDelay -1, 0
enabled (from your earlier suggestions).
Once I removed it, it works great:

Code: Select all

; SetKeyDelay -1, 0
; SendMode "Input"

; Window snapping
#!Left::SendEvent "#{Left}"                                 ; Snap window to left side.     win + alt/option + left         ->      win + left
#!Right::SendEvent "#{Right}"                               ; Snap window to right side.    win + alt/option + right        ->      win + right
#!Up::SendEvent "#{Up}"                                     ; Window fullscreen.            win + alt/option + up           ->      win + up
#!f::SendEvent "#{Up}"                                      ; Window fullscreen.            win + alt/option + f            ->      win + up
That's great. As far as I can see, my script works perfectly and especially with AHK 2.
With v1 I had some issues when some hotkeys were pressed too fast after another like mark the whole line, cut/copy and paste. Jump at the end of the line and so forth.
Also, for instance holding alt/option and continuously press left or right key or even hold left or right key to move the cursor forwards or backwards in a document (e.g. when I code).
Then suddenly the hotkeys weren't recognized anymore, and instead the original windows commands were executed.
This lead to some very unwelcome behavior.
Thankfully, this seems to be resolved with v2.

So thanks again for this tool.
A fantastic productivity boost!
lexikos
Posts: 9780
Joined: 30 Sep 2013, 04:07
Contact:

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

19 Nov 2021, 17:55

micktg99 wrote:
19 Nov 2021, 08:50
It was not working when I had SendMode "Input" and SetKeyDelay -1, 0 enabled (from your earlier suggestions).
I made no such suggestion. What I said was:
There are two ways to reproduce it in v1:
In other words, add either of those to v1 to reproduce the issue. You don't want to reproduce the issue. It was to demonstrate why the problem occurred when you switched from v1 to v2, not a suggestion to fix your issue, although if you understood it, you could fix your issue by doing the opposite; SendMode "Event" and omitting SetKeyDelay (the default SendEvent delay should be sufficient).

SendMode does not affect SendEvent. SetKeyDelay -1, 0 only affects SendEvent (or Send with SendMode "Event").
drozdman
Posts: 78
Joined: 05 Dec 2015, 01:07

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

25 Apr 2023, 17:00

Is there any chance it will work in v2 as it did in v1? It still doesn't seem to.
I try to migrate to v2, but the most important key remapping doesn't work. I use "LWin" as "copy" (ctrl+c) and "LWin & Space" as "view clipboard" (to simplify the code). Windows key doesn't get blocked and Start Menu opens.

Code: Select all

LWin:: Send("^c")

LWin & Space::
{ 
  Tooltip(A_Clipboard)
  Sleep(1000)
  Tooltip
}
@gregster
Yep. It was a typo. Fixed.
Last edited by drozdman on 26 Apr 2023, 12:58, edited 1 time in total.
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

26 Apr 2023, 01:48

@drozdman, you are at least missing a : in LWin: Send("^c"): Hotkey definitions still use two colons: LWin::Send("^c")
Edit: But in up-to-date v2, this should have thrown an error anyway. So it was just a typo in the post here, I guess, and unrelated to the actual problem.
User avatar
xMaxrayx
Posts: 352
Joined: 06 Dec 2022, 02:56
Contact:

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

24 Apr 2024, 05:32

yeah I wish if we can this

Code: Select all

LWin UP::{
    return 
}
-----------------------ヾ(•ω•`)o------------------------------
https://github.com/xmaxrayx/
User avatar
xMaxrayx
Posts: 352
Joined: 06 Dec 2022, 02:56
Contact:

Re: Disable left windows key on Windows 11 with AHK 2 beta 3

27 Apr 2024, 03:51

Ok I did this it uses inputhock to deny AHK default behavior for {"Lwin -release"}

change the default shortcut with "switch" cases
you can see the switch with "r", you need to same with every shortcut you want, and if you don't it will return the key.



Code: Select all

        switch winKeyCombo {
            case "r":
                SendInput "{Lwin Down}{r}{LWin UP}"
                exit


full code (rooten, bad , not polished)

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force
; v1 [Laptop HQ] @xMaxrayx @Unbreakable-ray [Code : ReBorn]   at 12:35:16  on 24/4/2024   (24H Format)  (UTC +2) 	 {Can we prove we are stronger than before?}
; v1.5 [Laptop HQ] @xMaxrayx @Unbreakable-ray [Code : ReBorn]   at 10:20:40  on 25/4/2024   (24H Format)  (UTC +2) 	 {Can we prove we are stronger than before?}


InstallKeybdHook(1,1)


global EnableDebug := 0

global defaultWinBindKey:= "{F1}"
global timeWait := 0.5
global nonVisibleKeyList := ["Enter" , "Left" , "Right" , "UP" , "Down", "Backspace" , "Shift" ]
global longTimePress := "{blind}{LWin}"
global winHoldDownTime := 5


WinActivate("Untitled - Notepad")

LWin::{

    fasterDefaultWinBindKey() ;test for faster bind   


    WinKeyDown_status := GetKeyState("Lwin" , "P") ; sotted to "P" because the hook mode
    
    if WinKeyDown_status == 1{ 

        afterWinKey := InputHook()
        afterWinKey.KeyOpt("{ALL}", "E N")
        afterWinKey.KeyOpt("{LCtrl}{RCtrl}{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}", "-E") ;{LWin}{RWin}
        
        
        afterWinKey.Start()
        ; fasterDefaultWinBindKey() ;test for faster bind ;disabled for better solution X12a
                
        ;   SetTimer fasterDefaultWinBindKey_timer  disabled for better solution 
        
        
        
        afterWinKey.Wait(0.1)
        global winHoldDownTime
        global i := 0                                                                                      ;solution X12a
        while (GetKeyState("LWin" ,"P") == 1) && afterWinKey.EndKey == "" && winHoldDownTime > i  {                  ;solution X12a
            afterWinKey.Wait(0.1)
            i++                                                                                   ;solution X12a
        }
        
        if i >= winHoldDownTime
            {   
                msgdebug("long key mode`n" ThisHotkey "`n" GetKeyState("LWin" ,"P"))
                SendInput longTimePress
                KeyWait("LWin", "L")
                while  GetKeyState("LWin" ,"P")==1{
                    if  GetKeyState("LWin" ,"P")==0 
                        {   
                            msgdebug("exit whole winkey")
                            exit
                        }
                }
                Exit
                ; MsgBox
                ; exit ;issue bug-001
            }
        ; MsgBox "ss"
        
    msgdebug("Not long mode")


        winKeyCombo := afterWinKey.EndKey afterWinKey.EndMods

        fasterDefaultWinBindKey() ;test for faster bind

        switch winKeyCombo {
            case "r":
                SendInput "{Lwin Down}{r}{LWin UP}"
                exit
            case "":

                if i >= winHoldDownTime
                    {   
                        
                        ; MsgBox "you hold down the win key key without pressing another key :3 <3"
                        SendInput(longTimePress)
                        exit
                }

                else {
                    SendInput(defaultWinBindKey)
                    exit
                }
                
                return
            case "Space":

                msgdebug("is win key is down"  GetKeyState("LWin" ,"P"))
              
                msgdebug("you pressed space key !!! ^^")

                exit

            default:

                msgdebug("this A_ahk: " A_ThisHotkey)
                local EndKey__Clean := afterWinKey.EndKey
                global nonVisibleKeyList 
                loop nonVisibleKeyList.Length{
                    EndKey__Clean := RegExReplace(EndKey__Clean, "i)" . nonVisibleKeyList[A_Index]  , ('{' . nonVisibleKeyList[A_Index] . '}')) 
                }

                if EnableDebug == 1 {

                    MsgBox( "you pressed " winKeyCombo
                    "`n" 'is win pressed ' isWinKeyDown_status__string() '`n Realtime winkey down :'  GetKeyState("LWin" ,"P")
                    "`nEnd__clean value :" EndKey__Clean
                    )
                    return

                }
                
                ; EndKey__Clean := RegExReplace(EndKey__Clean, "i)enter" ,"{Enter}")
                ; EndKey__Clean := RegExReplace(EndKey__Clean, "i)left" ,"{}")
                ;to see if there something wrong with your combo shortcut
                SendInput(EndKey__Clean) ; need "" to convert non-visable key like enter
                exit
            }
    

        isWinKeyDown_status__string(*){
            local WinStatus__string := unset
            switch GetKeyState("LWin" ,"P"){
                case 0:
                    WinStatus__string := "No"
                case 1:
                    WinStatus__string := "Yes"
                default: 
                    WinStatus__string := "Unknown"
            }
            return "is win key is down? :"  . WinStatus__string
        }
        ;break ;safe code to do the  defoult bind
    }
    else {
        SendInput(defaultWinBindKey)
    }


    fasterDefaultWinBindKey(){ ;removed for better solution
        ; if GetKeyState("Lwin" , "P") == 0{
        ; SendInput(defaultWinBindKey)
        ; Exit
        ; }
    }

    fasterDefaultWinBindKey_timer(){
        L := 1
        while L == 1 {

        

        if GetKeyState("Lwin" , "P") == 0{
        ;SendInput(defaultWinBindKey)
        ; MsgBox "set timer winsattus :" GetKeyState("Lwin" , "P")
        SetTimer , 0
        Exit 
        }else{
            ; MsgBox "E12: " GetKeyState("Lwin" , "P")    
        }
        }
}


}



msgdebug(Text){
    EnableDebug  ?? true

    if EnableDebug == true {
        MsgBox(text)
    }

}
https://github.com/xmaxrayx/AHKv2-Disable-Winkey
-----------------------ヾ(•ω•`)o------------------------------
https://github.com/xmaxrayx/

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: boardtc, DavidP, vanove and 55 guests