Switch Bug!

Report problems with documented functionality
Rohwedder
Posts: 7656
Joined: 04 Jun 2014, 08:33
Location: Germany

Switch Bug!

03 Oct 2019, 01:13

Hallo,
this script kills Autohotkey 1.1.31.00 Unicode 64bit W7-Enterprise
not only here!
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=68504

Code: Select all

q::
a = b
b = 5
Switch %a%
{
	Case 5: MsgBox,% A_LineNumber
}
Edit:
The same with this script!
It's not correct, but I expect an error message instead of a death sentence.

Code: Select all

q::
a = 1
Switch a
{
	Case 2,,: MsgBox,% A_LineNumber
}
Last edited by Rohwedder on 03 Oct 2019, 05:30, edited 2 times in total.
toralf
Posts: 868
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: Switch Bug!

03 Oct 2019, 01:16

a contains the character b
ciao
toralf
Rohwedder
Posts: 7656
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Switch Bug!

03 Oct 2019, 01:46

That's what's wanted!
See 1. chapter of https://www.autohotkey.com/docs/Variables.htm#operators
and try:

Code: Select all

q::
a = b
b = 5
MsgBox,% %a%
toralf
Posts: 868
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: Switch Bug!

03 Oct 2019, 02:57

I”m on the road and only have my phone, hence I can”t test.
But I see that you are double referencing in your last example.
I do not have experience with switch yet, thus I do not know if it double references.
ciao
toralf
lexikos
Posts: 9593
Joined: 30 Sep 2013, 04:07
Contact:

Re: Switch Bug!

03 Oct 2019, 05:43

It's a bug. Also affects throw %a% and case %a%.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 31 guests