How do I make IF to work here?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Brunoire
Posts: 34
Joined: 25 Jun 2017, 16:44

How do I make IF to work here?

28 Jun 2017, 09:39

I want the script to work based on my reply.

Been trying something like this but keep getting errors:

Code: Select all

^!b::

MsgBox, How many?
	if, (number = 1)
	}
	{
	Goto, event1
	}
	{
	if, (number = 2)
	Goto, event2
	}
	{
	if, (number = 3)
	Goto, event3
	}
	{
	if, (number = 4)
	Goto, event4
	}
	{
	if, (number = 5)
	Goto, event5
	{	
	if, (number = 0)
	Goto, event0
	}
	else
	{
	ExitApp
	}
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: How do I make IF to work here?

28 Jun 2017, 10:11

Code: Select all

^!b::
  InputBox, number, Question!, How many (0-3)?
  If (number < 0 || number > 3) : if number is outside of the expected range, do nothing.
      Return
  Else
      Goto, event%number%

event0:
event1:
event2:
event3:
MsgBox % event%number%
Return
You should have a look how to set braces correctly!
Brunoire
Posts: 34
Joined: 25 Jun 2017, 16:44

Re: How do I make IF to work here?

28 Jun 2017, 10:25

I fixed the problem and now is working.

Thank you.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 378 guests