Jump to content

Hotkeys do not work when certain windows are active and Windows 10


Recommended Posts

Hi,

I have used auto it for a long time to automate many tasks for me.  I have multiple hotkeys set up to do certain actions. I recently migrated from Windows 7 64bit to Windows 10 64 bit.

My prescription works well for the most part and Windows 10.  However I have noticed when certain windows are active for example the dragon dictate dock Or a videogame botting program I have, none of the hotkeys work.

Do I need to give these windows some special privileges for these to work? If I click away from these windows to a different window the hotkeys work fine.

 

Link to comment
Share on other sites

Hotkeys can only be assigned to one task. If another task has already set the hotkey, hotkeyset () sets @error. This is the case here. Some programs only set the hotkeys when they are in the foreground and delete them when they are in the background.
So always check the return code of hotkeyset().
Here is a small example:

_Hotkeyset("#d","_Hotkeys")       ;  is reserved by windows to hide/show desktop
_Hotkeyset("x","_Hotkeys")        ;  is not defind as CASE.   Try it.
_Hotkeyset("{F2}","_Hotkeys")     ;  display a message
_Hotkeyset("{F3}","_Hotkeys")     ;  exit script

While Sleep(1000)
WEnd

Func _Hotkeyset($Key, $Func)
    If HotKeySet($Key, $Func) = 0 Then Return MsgBox(64+262144, " Hotkeyset Error", "Hotkey " & $Key & " already set by another task.", 0)
EndFunc   ;==>_Hotkeyset

Func _Hotkeys()
    Switch @HotKeyPressed
        Case "{F2}"
            MsgBox(64+262144, Default, "You pressed F2",2)
        Case "{F3}"
            Exit MsgBox(64+262144, Default, "Bye, Bye",2)
        Case "#d}"
            MsgBox(64+262144, Default, "WIN+D will never match.",0)
        Case Else
            MsgBox(64+262144, Default, "Hotkey:  " & @HotKeyPressed & "     is not defined as CASE.", 0)
    EndSwitch
EndFunc   ;==>_Hotkeys

 

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

You always have to check the returncode of Hotkeyset ().
If an error occurs, you must issue a warning message indicating which hotkey is already in use.
Then you have to close the program in question and then repeat the Hotkeyset ().

Or you change your program and use hotkeys that are never used by other programs.

App: Au3toCmd              UDF: _SingleScript()                             

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...