First of all, thank you so much for your help so far. I really am grateful.
Second, with your adjustments heres what I have. You can try it for yourself and tell me whats going on still. If you hit ^f and change the hotkey to ^4 it works. Then if you hit ^g to test an empty hotkey it also works. The problem is if you go to change it back to ^f it gives the nonexistent hotkey error on the line hotkey, %templatepreset1%, off. This translates to the user only being able to update the box once but I would like unlimited changes.
Code: Select all
TemplatePreset1=^1
TemplatePreset2=^2
TemplatePreset3=^3
gui, add, Hotkey, x25 y25 w350 vTemplatePreset1, ^1
gui, add, Hotkey, y+10 w350 vTemplatePreset2, ^2
gui, add, Hotkey, y+10 w350 vTemplatePreset3, ^3
gui,add, button, ,hello
Gui, Show, w500 h500
gosub, refreshhotkeys
return
GuiClose:
ExitApp
refreshhotkeys:
gui, submit, nohide
if (TemplatePreset1 <> "")
Hotkey,%TemplatePreset1%,ChooseTemplate1
if (TemplatePreset2 <> "")
Hotkey,%TemplatePreset2%,ChooseTemplate2
if (TemplatePreset3 <> "")
Hotkey,%TemplatePreset3%,ChooseTemplate3
return
^f::
gui, submit, nohide
Hotkey, %TemplatePreset1%, Off
TemplatePreset1=^4
guicontrol,, TemplatePreset1, ^4
gosub, refreshhotkeys
return
^g::
gui, submit, nohide
Hotkey, %TemplatePreset1%, Off
TemplatePreset1=
guicontrol,, TemplatePreset1,
gosub, refreshhotkeys
return
choosetemplate1:
msgbox, template1
return
choosetemplate2:
msgbox, template2
return
choosetemplate3:
msgbox, template3
return