#530 closed Bug (No Bug)
HotKeySet ignores optional parameters
Reported by: | danerjones@… | 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)
comment:1 follow-up: ↓ 2 Changed 16 years ago by Valik
- Resolution set to No Bug
- Status changed from new to closed
comment:2 in reply to: ↑ 1 Changed 16 years ago by anonymous
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:3 Changed 9 years ago by anonymous
feels like a bug to me, I just ran into this problem.
comment:4 Changed 9 years ago by BrewManNH
Still not a bug, read the help file. HotKeySet functions can NOT have parameters.
comment:5 Changed 9 years ago by TheDcoder
It would be nice feature request I presume.
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
This is not a bug.