n0dy Posted January 24, 2010 Share Posted January 24, 2010 Hi Guys. Can anyone answer me if "Or" function works in AutoIt? Because i have some code to use with "Or" function. As it is below in code.When i use my script without using or and only for 1 option, it works. But when adding below code using "Or" function, it doesnt work. Dim $var While 1 If ControlGetText ( "SOK Chatpoint++", "", "ThunderRT6TextBox5") = "Room" or ":d" or "no" Then ControlSetText("SOK Chatpoint++", "", "ThunderRT6TextBox6", "/mmm" ) sleep (10) ControlClick("SOK Chatpoint++", "", 12) Exit EndIf WEnd Help please. Maybe i am wrong. Regards, n0dy Link to comment Share on other sites More sharing options...
picea892 Posted January 24, 2010 Share Posted January 24, 2010 You need to spell it all out again. Dim $var While 1 If ControlGetText ( "SOK Chatpoint++", "", "ThunderRT6TextBox5") = "Room" or ControlGetText ( "SOK Chatpoint++", "", "ThunderRT6TextBox5") = ":d" or ControlGetText ( "SOK Chatpoint++", "", "ThunderRT6TextBox5") = "no" Then ControlSetText("SOK Chatpoint++", "", "ThunderRT6TextBox6", "/mmm" ) sleep (10) ControlClick("SOK Chatpoint++", "", 12) Exit EndIf WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 24, 2010 Moderators Share Posted January 24, 2010 n0dy, Maybe i am wrongYup! $sText = ControlGetText ( "SOK Chatpoint++", "", "ThunderRT6TextBox5") ; We get the value here to save space on the line below If $stext = "Room" Or $stext = ":d" Or $stext = "no" Then ; Otherwise we have to use the whole ControlGetText 3 times here! ControlSetText("SOK Chatpoint++", "", "ThunderRT6TextBox6", "/mmm" ) sleep (10) ControlClick("SOK Chatpoint++", "", 12) Exit Endif But you could use a Switch structure to simplify matters: Switch ControlGetText ( "SOK Chatpoint++", "", "ThunderRT6TextBox5") Case "Room", ":d", "no" ControlSetText("SOK Chatpoint++", "", "ThunderRT6TextBox6", "/mmm" ) sleep (10) ControlClick("SOK Chatpoint++", "", 12) Exit EndSwitch 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...
PsaltyDS Posted January 24, 2010 Share Posted January 24, 2010 You can use Switch/Case that way: Switch ControlGetText("SOK Chatpoint++", "", "ThunderRT6TextBox5") Case "Room", ":d", "no" ; Do stuff on match Case Else ; Do stuff on no match EndSwitch Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
n0dy Posted January 24, 2010 Author Share Posted January 24, 2010 (edited) Ok thanks alot for help Buddy. Please help me some more. If i set text condition as "Round #2: Peoples !d DRAW your card. 20seconds." When it is retrieved from control, its not doing the next things. Why? Because this is the conditional text i want to set, so in script how should i fix it as conditional set text. This is the code. Dim $var While 1 If ControlGetText ( "SOK Chatpoint++", "", "ThunderRT6TextBox5") = "Round #2: Peoples !d DRAW your card. 20seconds." Then ControlSetText("SOK Chatpoint++", "", "ThunderRT6TextBox6", "/mmm" ) sleep (10) ControlClick("SOK Chatpoint++", "", 12) Exit EndIf WEnd I think maybe i have to add something else also with that text in script so that it will work?Please help. Edited January 24, 2010 by n0dy Link to comment Share on other sites More sharing options...
n0dy Posted January 24, 2010 Author Share Posted January 24, 2010 Maybe the set text i want have spaces and special characters like # and ! and it is long text?Is that the problem? Link to comment Share on other sites More sharing options...
n0dy Posted January 24, 2010 Author Share Posted January 24, 2010 Anyone can help please? Why cant i set text with spaces and characters like ! and # Link to comment Share on other sites More sharing options...
n0dy Posted January 24, 2010 Author Share Posted January 24, 2010 Why its not working guys? Link to comment Share on other sites More sharing options...
n0dy Posted January 24, 2010 Author Share Posted January 24, 2010 here is my code While 1 Switch ControlGetText ( "SOK Chatpoint++", "", "ThunderRT6TextBox5") Case "ROUND #1: Players, !d to DRAW. 20 seconds.", "ROUND #2: Players, !d to DRAW. 20 seconds.", "ROUND #3: Players, !d to DRAW. 20 seconds." ControlSetText("SOK Chatpoint++", "", "ThunderRT6TextBox6", "oh no :d" ) sleep (10) ControlClick("SOK Chatpoint++", "", 12) Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
somdcomputerguy Posted January 25, 2010 Share Posted January 25, 2010 Maybe the set text i want have spaces and special characters like # and ! and it is long text?Is that the problem?I don't know for sure, I'm shooting in the dark here, but try changing ExpandVarStrings from default (0) to 1Function AutoItSetOption - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
n0dy Posted January 25, 2010 Author Share Posted January 25, 2010 Where should i add Opt("ExpandEnvStrings",1) in my code? PLEASE HELP Code is already given Above. Link to comment Share on other sites More sharing options...
n0dy Posted January 25, 2010 Author Share Posted January 25, 2010 Anyone There to Help and share any solution to fix this? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 25, 2010 Moderators Share Posted January 25, 2010 n0dy,Please only bump your own topic once every 24 hrs - not every 24 mins! 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...
somdcomputerguy Posted January 25, 2010 Share Posted January 25, 2010 Where should i add Opt("ExpandEnvStrings",1) in my code? PLEASE HELP Code is already given Above.In the code you have displayed, I would put it before the While 1. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. 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