Code: Select all
UserProfile := EnvGet "UserProfile"
Code: Select all
UserProfile := EnvGet "UserProfile"
Code: Select all
f() {
EnvGet := "Get the "
UserProfile := EnvGet "UserProfile"
return UserProfile
}
MsgBox f()
I disagree, you will make the mistake of trying to make a function call like this once, and then never again. So in all subsequent cases the error message is accurate.the real error is that the EnvGet call is missing the parentheses. I think it would be great if the error message could be improved for the case of missing parentheses, in particular now that AHK 2 is new and many users converting their scripts will probably run into this kind of error.
if the syntax is valid, why en error message is posted then? (and adding parentheses doesn't change anything for me, getting same error)"The code has valid syntax - as far as the program is concerned, missing parentheses is not the problem"
Code: Select all
UserProfile := EnvGet("UserProfile")
Code: Select all
doStuff(function) {
function.Call()
}
#!^Numpad0::
{
;The Send call here generates the error unless you add parentheses around the string parameter.
doStuff(() => Send "stuff to type{Enter 2}" )
}