Jump to content

Temporarily Disable Hotkey Filtering


 Share

Recommended Posts

Hey all,

Quick question, I am using several hotkeys in my script and currently have it setup to disable the hotkeys if the script does not have focus.

However the specific hotkeys do not function in other programs or the OS when they are "disabled".

It appears that AutoIt is still filtering the specific keys.

Example:

While 1
    
    $CurWindowEx = WinGetTitle("active")
    
    If $CurWindowEx = "Search Tool" Then
        HotKeySet ("{F5}" ,"EndSearch")
        HotKeySet ("{Esc}", "UIClose")
        HotKeySet ("{F2}", "Welcome")
        HotKeySet ("!{F4}","altf4")
        HotKeySet ("!{F1}", "State_Debug")
    Elseif $CurWindowEx <> "Search Tool"    Then    
        HotKeySet ("{F5}","")
        HotKeySet ("{Esc}","")
        HotKeySet ("{F2}", "")
        HotKeySet ("!{F4}","")
        HotKeySet ("!{F1}","")
    Endif
    
    $Event_Man = GUIGetMsg()
        Select
            Case $Event_Man = $GUI_EVENT_CLOSE
                FindUIClose()
        EndSelect
Wend

How can I completely disable AutoIt's filtering of hotkeys when it is not in focus (active window)?

Thanks.

Link to comment
Share on other sites

Do you think Au3Check is just joking with you when it errors out or what?

C:\Users\Admiral\AutoIt TNG\Från forumet\401.au3(10,22) : ERROR: (): undefined function.

HotKeySet ("{F5}","")

(may need SciTE4AutoIt3, don't remember, but you should have it already for the tons of improvements it adds to your AutoIt experience, not using it is insane!))

As to the actual problem, you should not give it a empty string, you should skip the parameter, just like the helpfile says:

function - [optional] The name of the function to call when the key is pressed. Not specifying this parameter will unset a previous hotkey.

Easy peasy :mellow:
Link to comment
Share on other sites

Do you think Au3Check is just joking with you when it errors out or what?

??? Not following you, that is just a small section of the entire script (almost 2000 lines).

Currently using SciTE4AutoIt3. :mellow: <- AWESOME

As to the actual problem, you should not give it a empty string, you should skip the parameter, just like the helpfile says:

Easy peasy :)

Ahh, jeese... good catch. Will try that now.

---

Update:

SUCCESS, thanks Admiral.

Love it when the solution is just following proper syntax. HA.

Edited by MIRAG3
Link to comment
Share on other sites

  • Developers

(may need SciTE4AutoIt3, don't remember,

Yes, else it will just run AutoIt3.exe for Run and Aut2EXE.exe for Compile/build.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

??? Not following you, that is just a small section of the entire script (almost 2000 lines).

Currently using SciTE4AutoIt3. :) <- AWESOME

Are you saying you have more errors or? I mean, there should be zero, so the HotKeySet()'s being wrong when they error should be kinda obvious, shouldn't it?

:mellow:

Link to comment
Share on other sites

Why not look at GUISetAccelerators() instead, as HotKeySet() is Global and can sometimes conflict with other programs using the same HotKey's. GUISetAccelerators()' are bound to the GUI handle you pass to the function.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Awesome!

Thanks Admiral and Jos!

Thanks for the suggestion Guiness, will take a look at GUISetAccelerators().

Turned out to be human error, following correct syntax helps!

Are you saying you have more errors or? I mean, there should be zero, so the HotKeySet()'s being wrong when they error should be kinda obvious, shouldn't it?

:mellow:

That's the weird part, AutoIt didn't return an error for the HotKeySet ("{Esc}","") sytnax.

No worries, working now.

Edited by MIRAG3
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...