I'm trying to learn how to use glabels as functions. I have a gcontrol set to a function and it is working without error when I click on the control in the gui. However, I would also like to access the function by using a keyboard shortcut but when I do so I get an error. Here is part of the code that leads to the error:
Code: Select all
Test(i="")
{
Global
if instr(i, "key")
i := substr(i, 4)
else
i := substr(A_guicontrol, 2)
Guicontrolget, c%i%
if (c%i% != "")
soundbeep
}
f1:: Test("key1")
There is no error message if I click on the control with the variable name c1 but using the F1 shortcut I get:
Warning: This variable has not been assigned a value.
Specifically: c (a global variable)
How to address this issue so that I don't get the error message? Thanks.