Modify

Opened 16 years ago

Closed 16 years ago

Last modified 9 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 follow-up: Changed 16 years ago by Valik

  • Resolution set to No Bug
  • Status changed from new to closed

This is not a bug.

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.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.