I have no clue how to deal with this error. I've read the #Warn help page, but I was unsuccessful to implement it to sidestep this.
An #Warn error needs to be identified and handled
An #Warn error needs to be identified and handled
Win 10 Professional 64bit 21H2 16Gb Ram AHK current as of 2021-12-26 .
Re: An #Warn error needs to be identified and handled
First of all, #warn-ings are not errors. Warnings are about potential causes for errors... on first glance I didn't even know why it would warn you about the variable in_len, since this variable seems to get assigned in your script before it gets read.
But then there is the line #if out_len := (in_len +4) which probably doesn't do what you expect anyway. Please remove it - in its current form, it doesn't make sense.
Perhaps you meant instead
As you probably know, the #if directive is only used for creating (or disabling) context-sensitive hotkeys and hotstrings... you seem to try to use it as a regular if-check... but even then you shouldn't use the := assignment operator, but the = operator. At the moment, this expression (almost) always evaluates to true, as it just assigns a non-zero value to a variable.
But the actual problem is most likely this special behaviour of the #if-directive:
Luckily, the (corrected) line if (out_len = (in_len +4) ) - without a directive - wouldn't be affected by this problem, as it would be executed only after in_len has been assigned.
But then there is the line #if out_len := (in_len +4) which probably doesn't do what you expect anyway. Please remove it - in its current form, it doesn't make sense.
Perhaps you meant instead
Code: Select all
if (out_len = (in_len +4) )
But the actual problem is most likely this special behaviour of the #if-directive:
That means, the #if out_len := (in_len +4) line may be executed even before in_len is first assigned in the Alt+F12 hotkey (which happens in line: in_len := strlen(in_put) ). In this case, the warning would be issued...https://www.autohotkey.com/docs/commands/_If.htm#General_Remarks wrote:The expression may also be evaluated whenever the program needs to know whether the hotkey is active.
Luckily, the (corrected) line if (out_len = (in_len +4) ) - without a directive - wouldn't be affected by this problem, as it would be executed only after in_len has been assigned.
Re: An #Warn error needs to be identified and handled
gregster, much thanks again, it makes perfect sense after your explanation.
Win 10 Professional 64bit 21H2 16Gb Ram AHK current as of 2021-12-26 .