Jump to content
Sign in to follow this  
Kovacic

Hotkey alternative needed

Recommended Posts

I know there is a simple way to do this, but I can't remember and can't find the proper way.. I just need to set a hotkey that is only active while the GUI is up. When the GUI is minimized or no longer in focus, I need it to release the bound key. I have the enter key bound for barcode scanning and when the app is minimized, it holds on to the enter key. I know there is a simple way to fix this, but I don't recall how.. I cant post the app because its massive and wont start if you try to use it outside our environment. Here is my little test script..

 

Any ideas are greatly appreciated!

 

#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
GUICreate("Form1", 318, 118, 192, 124)
GUISetState(@SW_SHOW)
HotKeySet("{ENTER}", "HotKeyPressed")
Local $hDLL = DllOpen("user32.dll")
While 1
    If _IsPressed("12", $hDLL) Then _IsKeyPressed()
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Func HotKeyPressed()
    TrayTip("HotKey", "I see the Enter key using the HotKeySet function.", 10, 1)
EndFunc   ;==>HotKeyPressed
Func _IsKeyPressed()
    TrayTip("_IsKeyPressed", "I see the Alt button using the _IsKeyPressed function.", 10, 1)
EndFunc   ;==>_IsKeyPressed

 


C0d3 is P0etry( ͡° ͜ʖ ͡°)

Share this post


Link to post
Share on other sites

GUIAccelerators()?


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

Share this post


Link to post
Share on other sites

You could write a function to enable the HotKey only when the window is visible and active (WinGetState). If it is not, either disable it or do nothing based on a flag you set.

Add this function to AdlibRegister.

EDIT: or simply WinActive()

Edited by JohnOne
add content.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Thats it!! Many Thanks!!

You're welcome.


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

Share this post


Link to post
Share on other sites

Not sure if this will help you, OP, but you could also just unbind the hotkey.

You know how you would use HotKeySet( "{F2}", "_MyFunction" ) to bind a hotkey?

Well you can also use HotKeySet( "{F2}" ) to unbind a hotkey.

In other words, whenever your gui is set to close, use Hotkeyset("{YOURKEY}") to unbind the hotkey and make it usable again.

Also, it should be noted that you should use _isPressed if you want the hotkey to remain available while the script is running as hotkeyset doesn't allow the key to function as normally while it is bound to a function.

Alternatively, you could use

Do
    If _IsPressed(12) Then _IsKeyPressed()
Until WinGetState("Form1") = 5;5=hide, 15=show

 

Edited by BetaLeaf

 

False Positive Reporter - Mass email all anti-virus vendors with an attachment of your program for fast and easy whitelisting.

RollbarSDK UDF - Provides real-time error alerting & debugging tools for developers. 

 

Share this post


Link to post
Share on other sites

Not really, because HotKeySet is global when the OP wanted a GUI hook.


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

Share this post


Link to post
Share on other sites

I'm just providing alternative methods.

Great, but it's not the right method if you only want a hotkey to be attached to an AutoIt GUI. Unless you like writing a ton of boilerplate code for something AutoIt does in one line. So please next time think about what you're suggesting and whether it matches what the OP is asking. Since this was already answered, there was no need to resurrect an old thread.


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

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By generic-username
      I've been trying to use the hotkey but it doesn't seem to work. The console log says "AU3 Check ended" thing everytime I run the script, it annoys the hell out of me. I'm quite new to AutoIt. Any help would be greatly appreciated.
      HotKeySet("a", "notepad") HotKeySet("b", "notepad") HotKeySet("c", "notepad") HotKeySet("d", "notepad") HotKeySet("e", "notepad") HotKeySet("f", "notepad") HotKeySet("g", "notepad") HotKeySet("h", "notepad") HotKeySet("i", "notepad") HotKeySet("j", "notepad") HotKeySet("k", "notepad") HotKeySet("l", "notepad") HotKeySet("m", "notepad") HotKeySet("n", "notepad") HotKeySet("o", "notepad") HotKeySet("p", "notepad") HotKeySet("q", "notepad") HotKeySet("r", "notepad") HotKeySet("s", "notepad") HotKeySet("t", "notepad") HotKeySet("u", "notepad") HotKeySet("v", "notepad") HotKeySet("w", "notepad") HotKeySet("x", "notepad") HotKeySet("y", "notepad") HotKeySet("z", "notepad") HotKeySet("{[}", "notepad") HotKeySet("{]}", "notepad") HotKeySet("{'}", "notepad") HotKeySet("{;}", "notepad") HotKeySet("{,}", "notepad") HotKeySet("{/}", "notepad") HotKeySet("{?}", "notepad") HotKeySet("{.}", "notepad") HotKeySet("{<}", "notepad") HotKeySet("{>}", "notepad") HotKeySet("{}}", "notepad") HotKeySet("{\}", "notepad") HotKeySet("{{}", "notepad") HotKeySet("{|}", "notepad") HotKeySet("{=}", "notepad") HotKeySet("{+}", "notepad") HotKeySet("{-}", "notepad") HotKeySet("{_}", "notepad") HotKeySet("{(}", "notepad") HotKeySet("{)}", "notepad") HotKeySet("{*}", "notepad") HotKeySet("{&}", "notepad") HotKeySet("{^}", "notepad") HotKeySet("{%}", "notepad") HotKeySet("{$}", "notepad") HotKeySet("{#}", "notepad") HotKeySet("{@}", "notepad") HotKeySet("{!}", "notepad") HotKeySet("{`}", "notepad") HotKeySet("{~}", "notepad") HotKeySet("{1}", "notepad") HotKeySet("{2}", "notepad") HotKeySet("{3}", "notepad") HotKeySet("{4}", "notepad") HotKeySet("{5}", "notepad") HotKeySet("{6}", "notepad") HotKeySet("{7}", "notepad") HotKeySet("{8}", "notepad") HotKeySet("{9}", "notepad") HotKeySet("{0}", "notepad") Func notepad() Run("notepad.exe") EndFunc  
    • By Dan_555
      Hi, 
      here is a configurable HotKey Gui script, which i wrote for my current Project:
      #include <Array.au3> #include <ComboConstants.au3> #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <String.au3> #include <WindowsConstants.au3> #include <Array.au3> Global $snip_inifile = @ScriptDir & "\" & "hotkeygui.ini" ;If $HKSTRING is changed, make sure to adjust the $z number in the SetHotkeyKeys function. Local $HKSTRING = "[;][#;Win][!;Alt][+;Shift][^;Ctrl][0;0][1;1][2;2][3;3][4;4][5;5][6;6][7;7][8;8][9;9][a;a][b;b][c;c][d;d][e;e][f;f][g;g][h;h][i;i][j;j][k;k][l;l][m;m][n;n][o;o][p;p][q;q][r;r][s;s][t;t][u;u][v;v][w;w][x;x][y;y][z;z][{PAUSE};Pause][{BREAK};Break][{HOME};Home/Pos1][{END};END][{PGUP};Page UP][{PGDN};Page Down][{F1};F1][{F2};F2][{F3};F3][{F4};F4][{F5};F5][{F6};F6][{F7};F7][{F8};F8][{F9};F9][{F10};F10][{F11};F11][{F12};F12][{SPACE};Space]" Local $HKT = _StringBetween($HKSTRING, "[", "]") Global $HK, $HKS Global $h_HotkeyTestInput Dim $HK[0][2] ;Hotkey keys+names Dim $HKS[6] ;Hotkey (ini)settings 0-3 combo boxes, 4 = Redirect the hotkey test to the input box, 5=Current Hotkey Set. For $x = 0 To UBound($HKT) - 1 ;Make an array including the text from HKSTRING _ArrayAdd($HK, $HKT[$x], 0, ";") Next $HKT = "" $HKSTRING = "" SetHotkeyKeys(0) ;Set the initial hotkey SetHotkeyKeys(1) ;Open the config-gui while 1 ;Test the hotkey. Output is in the console. Exit through traymenue. sleep (10) WEnd Func SetHotkeyKeys($showgui = 0) ;$showgui 0 = Set the saved hotkeys, 1 = Show gui to change the settings Local $a, $b, $c, $z $z=4 ;$z of the text from $HK will go in to c1-c3, the rest goes to c4 $HKS[0] = IniRead($snip_inifile, "hotkey", "0", "4") $HKS[1] = IniRead($snip_inifile, "hotkey", "1", "0") $HKS[2] = IniRead($snip_inifile, "hotkey", "2", "0") $HKS[3] = IniRead($snip_inifile, "hotkey", "3", "12") $HKS[4] = 0 $HKS[5] = $HK[$HKS[0]][0] & $HK[$HKS[1]][0] & $HK[$HKS[2]][0] & $HK[$HKS[3] + $z + 1][0] If $showgui = 1 Then $HKS[4] = 1 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Hotkey Config", 317, 79, -1, -1, $WS_POPUP + $WS_CAPTION) $C1 = GUICtrlCreateCombo("", 4, 50, 72, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) $C2 = GUICtrlCreateCombo("", 82, 50, 72, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) $C3 = GUICtrlCreateCombo("", 161, 50, 72, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) $C4 = GUICtrlCreateCombo("", 239, 50, 72, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) $Label1 = GUICtrlCreateLabel("Please set a hotkey to use. Note: Not all combos may work.", 4, 30, 300, 17) $Button1 = GUICtrlCreateButton("Set + Save", 4, 4, 70, 23) $h_HotkeyTestInput = GUICtrlCreateInput("Test", 82, 5, 150, 21) $Button2 = GUICtrlCreateButton("Exit", 239, 5, 72, 23) _GUICtrlComboBox_SetMinVisible($C4, 60) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### For $x = 0 To UBound($HK) - 1 If $x <= $z Then _GUICtrlComboBox_AddString($C1, $HK[$x][1]) _GUICtrlComboBox_AddString($C2, $HK[$x][1]) _GUICtrlComboBox_AddString($C3, $HK[$x][1]) Else _GUICtrlComboBox_AddString($C4, $HK[$x][1]) EndIf Next _GUICtrlComboBox_SetCurSel($C1, $HKS[0]) _GUICtrlComboBox_SetCurSel($C2, $HKS[1]) _GUICtrlComboBox_SetCurSel($C3, $HKS[2]) _GUICtrlComboBox_SetCurSel($C4, $HKS[3]) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $Button2 GUIDelete($Form1) ExitLoop Case $Button1 $HKS[0] = _GUICtrlComboBox_GetCurSel($C1) ;Read the combo - boxes $HKS[1] = _GUICtrlComboBox_GetCurSel($C2) $HKS[2] = _GUICtrlComboBox_GetCurSel($C3) $HKS[3] = _GUICtrlComboBox_GetCurSel($C4) HotKeySet($HKS[5]) ;Clear the Old Hotkey $HKS[5] = $HK[$HKS[0]][0] & $HK[$HKS[1]][0] & $HK[$HKS[2]][0] & $HK[$HKS[3] + $z +1][0] ;Assemble the hotkey string, use $z+1 ! If HotKeySet($HKS[5], "DoHotkey") = 0 Then MsgBox(0, "Hotkey", "Err: Could not set. " & $HKS[5]) ;Set the hotkey or display a message IniWrite($snip_inifile, "hotkey", "0", $HKS[0]) ;Save the hotkey to the ini file IniWrite($snip_inifile, "hotkey", "1", $HKS[1]) IniWrite($snip_inifile, "hotkey", "2", $HKS[2]) IniWrite($snip_inifile, "hotkey", "3", $HKS[3]) EndSwitch WEnd EndIf If $HKS[4] = 0 Then ;Function was called with 0 $HKS[5] = $HK[$HKS[0]][0] & $HK[$HKS[1]][0] & $HK[$HKS[2]][0] & $HK[$HKS[3] + $z + 1][0] If HotKeySet($HKS[5], "DoHotkey") = 0 Then MsgBox(0, "Hotkey", "Err: Could not set. " & $HKS[5]) Else $HKS[4] = 0 EndIf EndFunc ;==>SetHotkeyKeys Func DoHotkey() If $HKS[4] = 0 Then ;Main function ConsoleWrite("PRESS" & @CRLF) Else ;Gui test code: GUICtrlSetData($h_HotkeyTestInput, "Hotkey ! " & @hour & ":" & @min & ":" & @SEC) EndIf EndFunc ;==>DisplayActiveProcess This script uses only 1 hotkey, and saves it  into an ini file.
      To load and use the saved Hotkey from the ini use: SetHotkeyKeys(0) 
      And to open the configuration window, use SetHotkeyKeys(1). 
      Have fun.
    • By Bhooshan
      I need to mute an ongoing call on Microsoft teams without activating the window. Teams allows us to mute using shortcut key Ctrl+Shift+m but only when the window is active.
      # Used set option as ongoing call can be with any person which leads to change in Title Name.
      AutoItSetOption ( "WinTitleMatchMode", 2 ) 
      # I am not clear with the control ID which will be good to use here and also the key combination of ^M       
      ControlSend ( "Microsoft Teams", "", "[CLASS:Intermediate D3D Window; INSTANCE:1]", "{ctrl down}")
       
      Can anyone help...!!! 
       

    • By caramen
      I am trying to record a ClipGet after Ctrl + C Is stroke.
      Not working. It is possible ? 
      While (1) $msg = GUIGetMsg () Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch Local $hDLL = DllOpen("user32.dll") If _IsPressed ("A2",$hDLL) And _IsPressed ("56",$hDLL) Then Sleep (500) $ClipBoard = ClipGet () ;~ ==========================================Console============================================ _GUICtrlListView_AddItem($ConsoleArea,""&$ClipBoard) _GUICtrlListView_EnsureVisible($ConsoleArea, _GUICtrlListView_GetItemCount($ConsoleArea)-1) ;~ =========================================/Console============================================ EndIf DllClose ($hDLL) WEnd  
    • By Blois
      Hi Guis,
       
      I need to create keyboard shortcut to navigate the tabs and activate them, but I could not use the code below:
      #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GuiTab.au3> #include <GUIConstantsEx.au3> HotKeySet("^{TAB}", "_TabRight") HotKeySet("^+{TAB}", "_TabLeft") $gui = GUICreate("test",450, 300) $Tab1 = GUICtrlCreateTab(20, 24, 425, 201) $TabSheet1 = GUICtrlCreateTabItem("Tabsheet 1") $lbContagemGrupos2 = GUICtrlCreateLabel("aaaa", 50, 50) GUICtrlSetColor(-1, 0x0000FF) GUICtrlCreateTabItem("") $TabSheet2 = GUICtrlCreateTabItem(" ") $TabSheet3 = GUICtrlCreateTabItem(" ") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _TabRight() $CurPos = _GUICtrlTab_GetCurSel($Tab1) _GUICtrlTab_SetCurSel($Tab1, $CurPos + 1) $tab = "$TabSheet" & $CurPos GUICtrlSetState($TabSheet1 + $CurPos, $GUI_SHOW) Return EndFunc Func _TabLeft() $CurPos = _GUICtrlTab_GetCurSel($Tab1) _GUICtrlTab_SetCurSel($Tab1, $CurPos - 1) $tab = "$TabSheet" & $CurPos GUICtrlSetState($TabSheet1 + $CurPos, $GUI_SHOW) Return EndFunc Exit  
      can you help me?
×
×
  • Create New...