Modify

Opened 18 years ago

Closed 18 years ago

Last modified 10 years ago

#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 by Valik, 18 years ago

Resolution: No Bug
Status: newclosed

This is not a bug.

in reply to:  1 comment:2 by anonymous, 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:3 by anonymous, 10 years ago

feels like a bug to me, I just ran into this problem.

comment:4 by BrewManNH, 10 years ago

Still not a bug, read the help file. HotKeySet functions can NOT have parameters.

comment:5 by TheDcoder, 10 years ago

It would be nice feature request I presume.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.