Jump to content


Recommended Posts

Hi guys,

I cant use the else function in the program. I dont know why. I have x64 processor and windows 7 x64.

I am doing this type of thing:

if InputBox('', 1 or 3 or 5 or 7 or 9 or 11) then MsgBox(0, '', 'win') Else MsgBox(0, '', 'Lost')

and it returns me this error:

C:\Users\Marco Aurelio\Documents\Mis programaciones\Casino - Mini ruleta.au3(13,72) : ERROR: syntax error

if InputBox('', 1 or 3 or 5 or 7 or 9 or 11) then MsgBox(0, '', 'win') Else


Everytime i use else it returns me the same mistake. I dont know if its a mistake i do or its a bug.

I am new in this world.,

thanks to answer me.


Link to comment
Share on other sites

  • Developers

look at the helpfile for the proper syntax.. it needs to be on separate lines when ELSE is used.

The OR logic is also wrong ... and even the If Input() is wrong.

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
Live for the present,
Dream of the future,
Learn from the past.

Link to comment
Share on other sites

You have to assign the Inputbox a var and then check it.

Dim $Win[6]

$Win[0] = 1
$Win[1] = 3
$Win[2] = 5
$Win[3] = 7
$Win[4] = 9
$Win[5] = 11

$Message = InputBox("This is a test", "")

For $i = 0 To $Win[5] Step +1
If $Message = $Win[$i] Then
MsgBox(0, "Test", "WIN!")
If $i = 5 Then
MsgBox(0, "Test", "No WIN!")

MsgBox(0, "Test", "Done")

This is a ROUGH example, it can be done in better ways. But its just one I thought of real quick.

Edited by Damein


Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

  • Moderators


Welcome to the AutoIt forum. :oops:

It is not a bug - it is you! :)

Look at the syntax for If...Then and InputBox in the Help file - not exactly what you have there is is? :D

Try something like this:

$sAnswer = InputBox("Please Respond", "Please enter a number between 0 and 12")

If $sAnswer = 1 Or $sAnswer = 3 Or $sAnswer = 5 Or $sAnswer = 7 Or $sAnswer = 9 Or $sAnswer = 11 Then
    MsgBox(0, '', 'win')
    MsgBox(0, '', 'Lost')

You are obviously a new coder. Reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here - you will find other tutorials in the Wiki (the link is at the top of the page). There are even video tutorials on YouTube if you prefer watching to reading. :D

I know you want to start coding NOW, but a little study will save you a lot of trouble later on, believe me. Good luck. :rip:


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...