If else Question!

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
gandalfgarfield
Posts: 29
Joined: 20 Jun 2020, 22:27

If else Question!

18 Aug 2020, 02:59

Hello :D

Whats wrong with this script?

Code: Select all

InputBox, val, Input Key

Hotkey, %val%, script, UseErrorLevel
If errorlevel = 2
	Msgbox, Key not available
	reload

script:
Send Working
return
I wanted the Input box to reload if an unavailable key is entered in the inputbox, but even if i enter a valid key, it still reloads. HELP
garry
Posts: 3770
Joined: 22 Dec 2013, 12:50

Re: If else Question!

18 Aug 2020, 03:08

just short , not tested , but use brackets '{ }' if more then on line after if

Code: Select all

If (errorlevel = 2)
 {
Msgbox, Key not available
reload
}	
	
Last edited by garry on 18 Aug 2020, 03:10, edited 1 time in total.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: If else Question!

18 Aug 2020, 03:09

Code: Select all

InputBox, val, Input Key

Hotkey, %val%, script, UseErrorLevel
If errorlevel = 2
{
	Msgbox, Key not available
	reload
}

script:
Send Working
return
blocks (lines enclosed in braces)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb and 305 guests