When I run the script, I'd like 4 different hotkeys to be automatically enabled. There will be a button that opens another GUI with a hotkey picker. The thing I'm struggling with is trying to attach the update button to the hotkey that is running and then changing it when a user inputs a new hotkey they'd like to use. Below is my whole script with the GUI's separated.
Code: Select all
#SingleInstance, Force
/*
This is the loop for the hotkey that will be initialized when the script starts.
2::
loop, 2
{
Send {Space down}
Sleep 50
Send {Space up}
Sleep 10
}
/::reload
*/
;------------------------Main GUI (GUI 1)------------------------------
;----------------------------------------------------------------------
;----------------------------------------------------------------------
OnMessage(0x201, "WM_LBUTTONDOWN")
WM_LBUTTONDOWN()
{
PostMessage, 0xA1, 2
}
; SetWorkingDir, %A_ScriptDir%
/*
FileCreateDir,%A_ScriptDir%\TT Client Assets
SetWorkingDir,%A_ScriptDir%\TT Client Assets
*/
Gui, 1:-Caption ; Don't know if I want it to always be on top. Might have a hotkey to shift if back and forth. -Caption to make my own border.
Gui, 1:Color, 0x2bde73 ; Will change color later. Need to change its opacity.
Gui, 1:Add, Button, x175 y10 w20 h20 Border Center gGuiClose, X ; Need custom button image
; [Below] Adds image of button
/*my_picturefile = %A_Temp%\blue box.png
FileInstall, blue box.png, %my_picturefile%, 1
Gui, 1:Add, Picture, x56 y40 w80 h30 , %my_picturefile%
Gui, 1:Add, Picture, x56 y80 w80 h30 , %my_picturefile%
Gui, 1:Add, Picture, x246 y40 w80 h30 , %my_picturefile%
Gui, 1:Add, Picture, x246 y80 w80 h30 , %my_picturefile%
*/
; Checkboxes that eventually will need their own images.
Gui, 1:Add, CheckBox, x30 y45 ; Macro1
Gui, 1:Add, CheckBox, x30 y85 ; Macro 2
Gui, 1:Add, CheckBox, x220 y45 ; Macro 3
Gui, 1:Add, CheckBox, x220 y85 ; Macro 4
; The below is for the macro buttons. Here just for reference. Will delete after I add the images for buttons and functionality.
Gui, 1:Add, Button, x60 y40 w70 h20 gGui2, 2 Bullets ; Button for Macro1. When pressed, will pop up a new GUI to change the hotkey. Will be set to 2, 3, 4, 5 by default.
Gui, 1:Add, Button, x60 y80 w70 h20 gGui3, 3 Bullets ; Same as above
Gui, 1:Add, Button, x250 y40 w70 h20 gGui4, 4 Bullets ; Same as above
Gui, 1:Add, Button, x250 y80 w70 h20 gGui5, 5 Bullets ; Same as above
Gui, 1:Add, Button, x30 y140 w100 h30, Get Premium ; Will run code meemee gave me in Google Chrome console to give player Premium. If can't do that, will use TAB/Mouse method.
Gui, 1:Add, Button, x220 y140 w100 h30, Classic Controls ; When clicked, uses "m" as "SPACE" for those that prefer classic controls.
Gui, 1:Add, Button, x30 y190 w100 h30, Game Tab Changer ; When clicked, enables a hotkey to press that changes tabs in game. May need to use TAB/mouse method or change this button to the chat hotkey.
Gui, 1:Add, Button, x220 y190 w100 h30, Client Hotkeys ; When clicked, changes the background color of the program (maybe) and opens a GUI that changes the hotkeys to exit the program and/or move the window to top or bottom.
Gui, 1:Show, w350 h250, Think Tank ; Calling ThinkTank Client for now. May change the name later. Need custom icon on top middle to display the text.
return
;------------------------Macro GUI 1 (GUI 2)---------------------------
;----------------------------------------------------------------------
;----------------------------------------------------------------------
Start_Hotkey:="1"
Hotkey, %Start_Hotkey% , Start
Gui2:
OnMessage(0x201, "WM_LBUTTONDOWN")
WM_LBUTTONDOWN()
Gui, 2:+AlwaysOnTop -Caption -Theme
Gui, 2:Color, blue
Gui, 2:Add, Hotkey, vStart_Hotkey, %Start_Hotkey%
Gui, 2:Add, Button, gUpdate_StartKey,Update
Gui, 2:Add, Button, gStart,Start
Gui, 2:Show, w200 h200
Update_StartKey:
GuiControlGet,New_Key,2:,Start_Hotkey
if(New_Key!=Start_Hotkey)
{
Hotkey, %Start_Hotkey% , Start,Off
Start_Hotkey:=New_Key
Hotkey, %Start_Hotkey% , Start,on
}
return
Start:
ToolTip,here
return
; Below doesn't work. Not sure why.
;ExitGui2:
;Gui, Gui2:Destroy
; Gui, 2:destroy ; Still trying to figure out how to close just this one without the caption.
;return
;------------------------Macro GUI 2 (GUI 3)---------------------------
;----------------------------------------------------------------------
;----------------------------------------------------------------------
Gui3:
OnMessage(0x201, "WM_LBUTTONDOWN")
WM_LBUTTONDOWN()
Gui, 3:+AlwaysOnTop -Caption -Theme
Gui, 3:Color, green
Gui, 3:Add, Button,,Update
Gui, 3:Add, Button, gExitGui3,Done
Gui, 3:Add, Hotkey,
Gui, 3:Show, w200 h200
ExitGui3:
; Gui, 3:destroy ; Still trying to figure out how to close just this one without the caption.
return
;------------------------Macro GUI 3 (GUI 4)---------------------------
;----------------------------------------------------------------------
;----------------------------------------------------------------------
Gui4:
OnMessage(0x201, "WM_LBUTTONDOWN")
WM_LBUTTONDOWN()
Gui, 4:+AlwaysOnTop -Caption -Theme
Gui, 4:Color, red
Gui, 4:Add, Button,,Update
Gui, 4:Add, Button, gExitGui4,Done
Gui, 4:Add, Hotkey,
Gui, 4:Show, w200 h200
ExitGui4:
; Gui, 4:destroy ; Still trying to figure out how to close just this one without the caption.
return
;------------------------Macro GUI 4 (GUI 5)---------------------------
;----------------------------------------------------------------------
;----------------------------------------------------------------------
Gui5:
OnMessage(0x201, "WM_LBUTTONDOWN")
WM_LBUTTONDOWN()
Gui, 5:+AlwaysOnTop -Caption -Theme
Gui, 5:Color, yellow
Gui, 5:Add, Button,,Update
Gui, 5:Add, Button, gExitGui5,Done
Gui, 5:Add, Hotkey,
Gui, 5:Show, w200 h200
ExitGui5:
; Gui, 5:destroy ; Still trying to figure out how to close just this one without the caption.
return
;------------------------GUI for Client Hotkeys (GUI 6)----------------
;----------------------------------------------------------------------
;----------------------------------------------------------------------
GuiClose:
ExitApp
Escape::ExitApp
return