My idea is to create a script with a simple GUI for AFK in gaming without being kicked, which will simulate us for holding two different keyboard button for a while alternately (default will be "w" and "s").
I also want to include a function that allow me to change the button that going to be held while running the script through GUI, like by invoking the Gui.Add("Hotkey", "...").
which may be something look like this:
Code: Select all
MyGui := Gui()
MyGui.Add("Text",,"Key 1: ")
MyGui.Add("Text",,"Key 2: ")
MyGui.Add("Hotkey", "vChosenHotkey ym")
MyGui.Add("Hotkey", "vChosenHotkey2")
MyGui.Add("Button", "Default" ,"OK").OnEvent("Click", keychange)
MyGui.Show()
keychange(*)
{
Saved := MyGui.Submit()
MsgBox("You have chose " Saved.ChosenHotkey " and " Saved.ChosenHotkey2)
action()
}
action(*)
{
loop{
Send "{Saved.ChosenHotkey down}"
Sleep 1000
Send "{Saved.ChosenHotkey up}"
Sleep 3000
Send "{Saved.ChosenHotkey2 down}"
Sleep 1000
Send "{Saved.ChosenHotkey2 down}"
Sleep 3000
}
}
#Esc::ExitApp
However, the above code doesn't really work as what I expect...
Can I ask how can I modify my code the perform such features?