Autohotkey - set a hotkey to toggle (disabled-enabled a hole autohotkey script)

Solution 1:

This code will never run

scrolllock:: Pause

var := 29 

F1:: MsgBox, %var%

because you try to set a variable between hotkeys.

A variable has to be defined in the auto executable section of the script (top of the script, before the first return or hotkey)

; top of the script:
var := 29
    return      ; end of auto-execute section

scrolllock:: Pause

F1:: MsgBox, %var%

or in a hotkey

scrolllock:: Pause

F1:: 
var := 29
MsgBox, %var%
return 

or in a function.