Skitty Posted January 25, 2011 Posted January 25, 2011 Func _Select() $I = InputBox("Command Center"," ","","",200,100) Select Case $I = "kill" Or "exit" Or "stop" Or "Kill" Or "Exit" Or "Stop" Or "KILL" Or "EXIT" Or "STOP" Exit Case $I = "create" Or "Create" Or "CREATE" _create() Case $I = "lock" Or "Lock" Or "LOCK" _lock() Case $I = "unlock" Or "Unlock" Or "UNLOCK" Or "un-lock" Or "Un-lock" Or "UN-LOCK" or "un lock" Or "Un lock" Or "UN LOCK" Or "Un Lock" Or "Un-Lock" _unlock() Case $I = "google" Or "Google" Or "GOOGLE" ShellExecute("http://www.google.com") Case $I = "au3" ShellExecute("http://www.autoitscript.org") Case Else MsgBox(0,"Syntax error","'" & $I & "'" & " is not recognized as an internal or external command." & _ @LF & "Correct your syntax and try again.") EndSelect EndFuncI find that with an excessive amount of Or's my program just skips the whole case thing. but if I remove a few of them then its all cool. why
AdmiralAlkex Posted January 25, 2011 Posted January 25, 2011 That is not how you do Or. This is how you Or: $I = "kill" Or $I = "exit" See "Language Reference - Conditional Statements" in helpfile. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
ripdad Posted January 25, 2011 Posted January 25, 2011 Cases are "case insensitive" - try it with Switch - looks nicer without Or's Func _Select() Local $I = InputBox("Command Center", " ", "", "", 200, 100) Switch $I Case "kill", "exit", "stop" Exit Case "create" _create() Case "lock" _lock() Case "unlock", "un-lock", "un lock" _unlock() Case "google" ShellExecute("http://www.google.com") Case "au3" ShellExecute("http://www.autoitscript.org") Case Else MsgBox(0, "Syntax error", "'" & $I & "'" & " is not recognized as an internal or external command." & _ @LF & "Correct your syntax and try again.") EndSwitch EndFunc "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward
Skitty Posted January 25, 2011 Author Posted January 25, 2011 (edited) That is not how you do Or.This is how you Or:$I = "kill" Or $I = "exit"See "Language Reference - Conditional Statements" in helpfile.Thank you, now I know for future reference! Cases are "case insensitive" - try it with Switch - looks nicer without Or'sThanks. What ripdad stated fixed my issue! Edited January 25, 2011 by xJSLRx
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