Jump to content
Sign in to follow this  
n0dy

Simple question

Recommended Posts

n0dy

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

Share this post


Link to post
Share on other sites
picea892

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

Share this post


Link to post
Share on other sites
Melba23

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


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
n0dy

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

Share this post


Link to post
Share on other sites
n0dy

Maybe the set text i want have spaces and special characters like # and ! and it is long text?Is that the problem?

Share this post


Link to post
Share on other sites
n0dy

Anyone can help please? Why cant i set text with spaces and characters like ! and #

Share this post


Link to post
Share on other sites
n0dy

: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

Share this post


Link to post
Share on other sites
somdcomputerguy

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.

Share this post


Link to post
Share on other sites
n0dy

Where should i add Opt("ExpandEnvStrings",1) in my code? PLEASE HELP Code is already given Above.

Share this post


Link to post
Share on other sites
n0dy

Anyone There to Help and share any solution to fix this?

Share this post


Link to post
Share on other sites
Melba23

n0dy,

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

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
somdcomputerguy

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.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.