Link to post

Share on other sites

jvanegmond 297

jvanegmond 297

You can only use @exitCode in a function registered by OnAutoItExitRegister or the old way in a function called OnAutoItExit. These are called once the Exit method is called, and the actual @exitCode is set. Otherwise, the @exitCode is not set and you will get a "Error: Unknown macro" error. (Because, at the time of calling the macro's value is unknown).

Share this post

Link to post

Share on other sites

jer 0

jer 0

You can only use @exitCode in a function registered by OnAutoItExitRegister or the old way in a function called OnAutoItExit. These are called once the Exit method is called, and the actual @exitCode is set. Otherwise, the @exitCode is not set and you will get a "Error: Unknown macro" error. (Because, at the time of calling the macro's value is unknown).

Thanks for the clarification. This explanation would be a great addition to the Autoit Help file, which does not mention this limitation! If calling without using OnAutoItExitRegister, the error indicates that that the @exitcode macro does not exist, which seems to be a bug. If it does not yet have a value, then it should return null or blank. Thanks again.