Jump to content

Can my Case statement contain AND?


Recommended Posts

Can I format my case statement like this without getting an error:

Case $msg = $pic1 AND $pic2

My goal is to check if a picture is clicked and also if a function has been "run through" before I want it to go to that certain Case statement.

I am extremely stumped on this but I know what I want to do.

Can this be accomplished?

Link to comment
Share on other sites

  • Moderators

well... did "You" try it??

8)

lol... he did say he was stumped...

msg = x and msg = y

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

lol... he did say he was stumped...

msg = x and msg = y

If you want to detect a pic has been click and some other condition has occurred then

$msg = x and $msg = y

will never work unless x and y are the same because $msg will either be one or the other.

Select
  Case $msg = $pic1 And $functionrun = true
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Moderators

If you want to detect a pic has been click and some other condition has occurred then

$msg = x and $msg = y

will never work unless x and y are the same because $msg will either be one or the other.

Select
  Case $msg = $pic1 And $functionrun = true
Don't think I need a lesson on what would or wouldn't work... I only showed the OP how to use an And statement.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Don't think I need a lesson on what would or wouldn't work... I only showed the OP how to use an And statement.

Please don't think I was trying to give you a lesson SmOke_N, my post was not intended for you. I thought, since the OP asked the question he did, that I should point out that he could not actually do, literally, what you posted. I'm sorry if I offended you; I do not know as much as you do and I doubt anyone thinks otherwise.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

If you want to detect a pic has been click and some other condition has occurred then

$msg = x and $msg = y

will never work unless x and y are the same because $msg will either be one or the other.

Select
  Case $msg = $pic1 And $functionrun = true
So you mean to say the following isn't true?

$len = StringLen("bob")
$rnd = Random(1, 5, 1)
...
Case $msg = $len AND $msg = $rnd
...

:) ???

Edited by aslani

[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

Link to comment
Share on other sites

So you mean to say the following isn't true?

$len = StringLen("bob")
$rnd = Random(1, 5, 1)
...
Case $msg = $len AND $msg = $rnd
...

:) ???

I didn't say that and I don't see how you decided I did. I said that unless the two values are the same, but maybe I should have said unless the three values are the same. This would be the same as your version

Case $rnd = $len And $msg = $len
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Moderators

Please don't think I was trying to give you a lesson SmOke_N, my post was not intended for you. I thought, since the OP asked the question he did, that I should point out that he could not actually do, literally, what you posted. I'm sorry if I offended you; I do not know as much as you do and I doubt anyone thinks otherwise.

I could have misinterpreted it, the fact that you "quoted" me without any iteration to the OP is what led me to believe it.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

you're right, you need a lesson on how to use sarcasm more effectively.

If I was trying to be sarcastic, maybe I'd take that lesson.

Why are you telling me Bye? You didn't think I was going to get banned for a comment like that did you?

No, but you aren't earning any "help me" brownie points either. I will indeed avoid any further contact with you and or your posts for help, and encourage others to do the same.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...