blqk Posted May 31, 2015 Share Posted May 31, 2015 Hello all,I have a little scripts that uses HotKeySet("{ESC}", "Action") , to go and execute the code in function "Action". Now I want to create a simple GUI with two boxes, the one will just contain the word "Action" and in the other the user will set the shortkey(like Alt+c, for example) and a "OK" button which when pressed will set the new shortkey combination in HotkeySet(). I have some idea how to create the gui and the buttons, but I am not sure how to do the rest. Any help will be appreciated. Link to comment Share on other sites More sharing options...
Starstar Posted May 31, 2015 Share Posted May 31, 2015 (edited) For every action you need a function for example......func Action1() .............. endfuncTherefore it will be better that create a GUICtrlCreateCombo() instead of GUICtrlCreateInput() for receiving an action. From this we can reduce chances of wrong input. Edited May 31, 2015 by Starstar Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
KaFu Posted May 31, 2015 Share Posted May 31, 2015 Take a look at Yashied's excellent HotKeyInput UDF. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Starstar Posted May 31, 2015 Share Posted May 31, 2015 (edited) expandcollapse popup#include <GUIConstantsEx.au3> #include <Misc.au3> $hGUI = GUICreate("Test", 200, 100) $cLabel = GUICtrlCreateLabel("Action", 10, 10, 50, 30) $cInput = GUICtrlCreateInput("", 100, 10, 80, 20) $cButton = GUICtrlCreateButton("Set HotKey", 100, 50, 80, 30) $hButton = GUICtrlCreateButton("Test Last key", 10, 50, 80, 30) GUISetState(@SW_SHOW) Global $send While 1 If _IsPressed(11) Then GUICtrlSetData($cInput,"^") ElseIf _IsPressed(12) Then GUICtrlSetData($cInput,"!") ElseIf _IsPressed(10) Then GUICtrlSetData($cInput,"+") EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton $cKeys = GUICtrlRead($cInput) If StringLen($cKeys) = 0 Then MsgBox(0,"","You must Enter a Key Before This") Else $cKeys = GUICtrlRead($cInput) IniWrite(@DesktopDir&"\keys.ini","Keys","1st",$cKeys) MsgBox(0,"","Hot keys set") Exit EndIf Case $hButton If FileExists(@DesktopDir&"\keys.ini") Then $gKeys = IniReadSection(@DesktopDir&"\keys.ini","Keys") HotKeySet($gKeys[1][1],"Action") ControlSetText("","",$cInput,$gKeys[1][1]) MsgBox(0,"","Are you Remember What was your last key?") Else MsgBox(0,"","You have not yet set any Hotkey") EndIf EndSwitch WEnd Func Action() MsgBox(0,"","Action Performs With This key: "&$gKeys[1][1]) EndFuncTry this one.....[Edit::]A fish for you.............. Edited May 31, 2015 by Starstar Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now