I am having troubles with #include
. I am using this documentation for syntax: docs. I have a simple test program which includes the vars.ahk file.
vars.ahk:
; Test vars
global x1 := 1
global x2 := 2
my_ahk_program.ahk:
#include C:\Users\user\Desktop\vars.ahk
function(x, x1, x2) {
; global x1, x2
If (x=1) {
newvar := %x1%
}
else if (x=2) {
newvar := %x2%
}
msgbox, the value is %newvar%
}
function(1, %x1%, %x2%)
msgbox, finished
My goal is to display the variable from the vars.ahk file in a msgbox, but it is not working. I get the error when I run this code. If I try to define any of the variables in vars.ahk or my_ahk_program.ahk as global instead of passing them into the function, the msgbox will show up with no value. How can I get #include
to work with variables? Thanks ahead of time!