Select/case?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Gabby
Posts: 28
Joined: 19 Aug 2017, 03:55

Select/case?

20 Aug 2017, 04:45

Is there a select/case statement or similar, without having to do a long and complex if else statement?

Andrew
SirRFI
Posts: 404
Joined: 25 Nov 2015, 16:52

Re: Select/case?

20 Aug 2017, 18:05

As far I know there is not, but once I found a post with a work-around for that:

Code: Select all

TMP := 2

If !IsLabel("Case-" TMP)
{
	;...
}
Else
{
	Loop 1
	{
		GoTo Case-%TMP%
		
		Case-1:
			;...
		Break
		
		Case-2:
			;...
		Break
		
		Case-3:
			;...
		Break
	}
}
Also, if it's something simple - perhaps array/object would do.
Use

Code: Select all

[/c] forum tag to share your code.
Click on [b]✔[/b] ([b][i]Accept this answer[/i][/b]) on top-right part of the post if it has answered your question / solved your problem.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Aqualest and 335 guests