Page 1 of 1

Help with GUI Varibles

Posted: 09 Sep 2020, 09:38
by CorruptingNostalgia
I need help with variable in guis. Can someone edit the script below so that when you change the edit and the chosen hotkey the variable instantly registeres the changes (if the user presses enter or deselects the text by clicking outside the box, you know what i mean?). the changes then applies the the hotkey and sleep functions as underlined .

Code: Select all

Gui, Show , w200 h100, Hold To Click Application
gui, add, text, section, Start/Pause Hotkey:
Gui, Add, Hotkey, vChosenHotkey
gui, add, text, section, Intervals:
Gui, Add, Edit, VInterval vMyEdit w100 number, Milliseconds
return

ChosenHotkey::
Sleep, Intervals
Click
As always, thanks in advanced :D :D .

Re: Help with GUI Varibles

Posted: 09 Sep 2020, 20:22
by mikeyww

Code: Select all

; Demonstrate hotkey selection
; https://www.autohotkey.com/boards/viewtopic.php?f=76&t=80829

gui, Add, text, section, Start/Pause Hotkey:
Gui, Add, Hotkey, vChosenHotkey
gui, Add, text, section, Intervals:
Gui, Add, Edit, vInterval w100 number, 1000
Gui, Add, Button, Default w80, Register
Gui, Show, w200, Select a hotkey
Return

GuiClose:
ButtonRegister:
Gui, Submit
If ChosenHotkey {
 StringUpper, ChosenHotkey, ChosenHotkey, T
 Hotkey, %ChosenHotkey%, Wait
 MsgBox,, Done, Try pressing %ChosenHotkey% now.
} Else MsgBox, 48, Empty, Nothing was registered.
Return

Wait:
MsgBox, 64, You pressed '%ChosenHotkey%', Let's wait for %Interval% milliseconds!
Return