Jump to content

Simple question


n0dy
 Share

Recommended Posts

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

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

  • Moderators

n0dy,

Maybe i am wrong

Yup! :D

$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

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:

Spoiler

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

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

:D

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

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 by n0dy
Link to comment
Share on other sites

:D 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

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 1

Function 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

  • Moderators

n0dy,

Please only bump your own topic once every 24 hrs - not every 24 mins! :D

M23

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:

Spoiler

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
 Share

  • Recently Browsing   0 members

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