Jump to content

Windows 10, (Windows Key + letter) doesn't work


Recommended Posts

I have a list of scripts I have brought over when I migrated to windows 10 today. This script was working (confirmed last week and unchanged) on windows 7, but windows 10 seems to have an issue with this.

HotKeySet ("#{j}", "StartTests")

However... if I strip out the windows key, just the j works fine

HotKeySet ("j", "StartTests")

 

Here is the full script...

Func Quit()
   Exit
EndFunc

Func StartTests()
   Send("Hello World")

   ; comment out function Quit() to keep script running until ESC key is pressed
   ;Quit()
EndFunc

;***********************
;* program starts here *
;***********************
HotKeySet ("#{j}", "StartTests") ; Calls function to start program
HotKeySet ("{ESC}", "Quit") ; Calls function to exit program immediately

;wait for the hotkey to be pressed
While 1
    Sleep(100)
WEnd

I've tried turning off anti-virus (coming with windows defender) and firewall. I have autoit set to run as admin. I have x64 version installed. I am running windows 10 pro x64. The regular windows key works (brings up the start menu), of course not during the script running though...

 

Anyone have any idea why this works with windows 7, but not with windows 10?

Link to comment
Share on other sites

HotKeySet ("#j", "StartTests") ; Calls function to start program

Try that

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I get 0 back from the hotkeyset command, meaning it failed to set the key. Might be a bug, or a documentation error.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

10 minutes ago, BrewManNH said:

I get 0 back from the hotkeyset command, meaning it failed to set the key. Might be a bug, or a documentation error.

A bug on Microsoft's part or a bug on AutoIT's part? Because it works in windows 7.

Link to comment
Share on other sites

must be a reserved key for the newer versions of the OS
You can look for a free one ;) 

#include <MsgBoxConstants.au3>
HotKeySet("{ESC}", "Terminate")
Global $iret, $letter = Asc('j')
Do
    $iret = HotKeySet("#" & Chr($letter), "ShowMessage")
    If Not $iret Then $letter += 1
    If $letter > 200 Then
        ConsoleWrite(@CRLF & '! none found !!!' & @CRLF& @CRLF)
        MsgBox($MB_SYSTEMMODAL, "", 'No Win + "letter" worked.' , 2)
        Exit 5
    EndIf
Until $iret
ConsoleWrite(@CRLF & 'The key is Win + ' & Chr($letter) & @CRLF& @CRLF)
MsgBox($MB_SYSTEMMODAL, "", 'The key is Win + ' & Chr($letter), 2)
While 1
    Sleep(100)
WEnd

Func Terminate()
    Exit
EndFunc   ;==>Terminate

Func ShowMessage()
    MsgBox($MB_SYSTEMMODAL, "", "This is a message.")
EndFunc   ;==>ShowMessage

Do change the title of the first post and add "[Solved]", as there is no bug and does work ( other than reserved ) :) 

Edited by argumentum
better code

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

2 hours ago, argumentum said:

must be a reserved key for the newer versions of the OS
You can look for a free one ;) 

#include <MsgBoxConstants.au3>
HotKeySet("{ESC}", "Terminate")
Global $iret, $letter = Asc('j')
Do
    $iret = HotKeySet("#" & Chr($letter), "ShowMessage")
    If Not $iret Then $letter += 1
    If $letter > 200 Then
        ConsoleWrite(@CRLF & '! none found !!!' & @CRLF& @CRLF)
        MsgBox($MB_SYSTEMMODAL, "", 'No Win + "letter" worked.' , 2)
        Exit 5
    EndIf
Until $iret
ConsoleWrite(@CRLF & 'The key is Win + ' & Chr($letter) & @CRLF& @CRLF)
MsgBox($MB_SYSTEMMODAL, "", 'The key is Win + ' & Chr($letter), 2)
While 1
    Sleep(100)
WEnd

Func Terminate()
    Exit
EndFunc   ;==>Terminate

Func ShowMessage()
    MsgBox($MB_SYSTEMMODAL, "", "This is a message.")
EndFunc   ;==>ShowMessage

Do change the title of the first post and add "[Solved]", as there is no bug and does work ( other than reserved ) :) 

Looks like you are right, windows 10 added A LOT of shortcut keys with the windows key. And because of this, the shortcut I've been using since 2008 can no longer be used. (Sad Day)

 

For anyone else reading this...

Here are the available key combinations you can use with the windows key (for Windows 10😞

"  '  -  /  :  <  >  ?  A  B  D  E  F  G  H  I  J  K  L  N  O  Q  R  U  X  Y  Z  [  \  ]  _  `  n  y  |  }  ~

Note: I also tried following these guides to turn off Windows Hot Keys using gpedit and/or regedit... but it didn't work for me:

https://answers.microsoft.com/en-us/windows/forum/all/how-to-disable-hot-keys/be2f571c-01f4-4f8c-af8d-3ffa71fd3d3b

https://www.isumsoft.com/it/disable-win-keyboard-shortcuts-in-windows-10/

If anyone finds a solution to disable windows hotkeys (that works), feel free to reply, otherwise, I recommend just sticking with the work-around of the available key combo's for the (Windows+X) keys I listed.

Link to comment
Share on other sites

3 hours ago, argumentum said:

Do change the title of the first post and add "[Solved]", as there is no bug and does work ( other than reserved ) :) 

Looks like it won't let me edit my own post, or the title of the thread. But for anyone who has permissions to do so, feel free to change this to "[Solved]"

Link to comment
Share on other sites

4 hours ago, vardahoth said:

Looks like it won't let me edit my own post, or the title of the thread. But for anyone who has permissions to do so, feel free to change this to "[Solved]"

Try it again. You need at least 5 posts to change your posts. And this limit is reached.

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

i love the hands-off of that key. i need it for all the windows shortcuts i constantly use. I really don't need a mouse, got that way in factories in the old days, I adapted and learned the goodness of the keyboard, then and now the windows key makes everything even easier

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Microsoft's documentation now says that the Windows Logo key shortcuts are reserved for the system and can't be remapped to another hotkey.

https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-registerhotkey

 

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...