#530 closed Bug (No Bug)
HotKeySet ignores optional parameters
| Reported by: | Owned by: | ||
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | Other | Severity: | None |
| Keywords: | HotKeySet, 457, optional parameter | Cc: |
Description
After executing this function:
HotKeySet("{ESC}", "QuitApp")
Func QuitApp($Quick = False)
If $Quick Then
Exit
EndIf
_FinishUp()
Exit
EndFunc
The following Error was returned.
>Running:(3.2.12.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Script.au3" C:\Script.au3 (457) : ==> Variable used without being declared.: If $Quick Then If ^ ERROR
It appears that when {ESC} is pressed, the optional parameter is not properly defined causing the error.
This issue only occurs when the function is triggered from HotKeySet and an optional parameter is declared.
I have rewritten the function to work around the issue for the time being.
HotKeySet("{ESC}", "QuitApp")
Func QuitApp($Quick = False)
If IsDeclared("Quick") Then
If $Quick Then Exit
EndIf
_FinishUp()
Exit
EndFunc
Attachments (0)
Change History (5)
follow-up: 2 comment:1 by , 18 years ago
| Resolution: | → No Bug |
|---|---|
| Status: | new → closed |
comment:2 by , 18 years ago
Replying to Valik:
This is not a bug.
Fair enough :o)
I would like to request the documentation for the "HotKeySet" function be modified to better clarify this as it doesn't implicitly state optional parameters will also be treated as if undefined when the target function is called from "HotKeySet"
comment:4 by , 10 years ago
Still not a bug, read the help file. HotKeySet functions can NOT have parameters.

This is not a bug.