markitus90 Posted November 20, 2011 Share Posted November 20, 2011 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. Marco Link to comment Share on other sites More sharing options...
Developers Jos Posted November 20, 2011 Developers Share Posted November 20, 2011 (edited) 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 November 20, 2011 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 More sharing options...
Damein Posted November 20, 2011 Share Posted November 20, 2011 (edited) 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!") ExitLoop EndIf If $i = 5 Then MsgBox(0, "Test", "No WIN!") ExitLoop EndIf Next 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 November 20, 2011 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 More sharing options...
Moderators Melba23 Posted November 20, 2011 Moderators Share Posted November 20, 2011 markitus90,Welcome to the AutoIt forum. 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? 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') Else MsgBox(0, '', 'Lost') EndIfYou 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. 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. M23 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: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
markitus90 Posted November 20, 2011 Author Share Posted November 20, 2011 Your speed answer is amazing. thanks to all. i will try that and after i will say anything. Certainly i was reading the help all the day. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now