Jump to content

Recommended Posts

Posted

Hopefully the always helpful folks in here can help me over a bump in my learning curve.

Basically - I want to have a dual condition as an "if" statement. Thing is, the entire script basically runs a loop over and over with no set stop point - so I need this WITHIN the script. (no perfect syntax - but the gist of it should come through)

If (a < 5 and b = 1) OR (a>5 and b=0) then

press buttonXYZ

stop the script

I don't have any specific code to this - i trashed my script and will re-write tonight, but I am getting stuck (I think) just on the logic of the expression.

Do I need to have something after if the "IF" expression does not meet either of the requirements?

Secondly - is there a "STOP" or "Break" function where I can basically just insert a line that says "STOP SCRIPT" or "EXIT" or something?

You guys have been very helpful in the past - I appreciate all the help.

Posted

Hopefully the always helpful folks in here can help me over a bump in my learning curve.

Basically - I want to have a dual condition as an "if" statement.  Thing is, the entire script basically runs a loop over and over with no set stop point - so I need this WITHIN the script. (no perfect syntax - but the gist of it should come through)

If (a < 5 and b = 1) OR (a>5 and b=0) then

press buttonXYZ

stop the script

Secondly - is there a "STOP" or "Break" function where I can basically just insert a line that says "STOP SCRIPT" or "EXIT" or something?

You guys have been very helpful in the past - I appreciate all the help.

<{POST_SNAPBACK}>

hmm how about using a while loop and select-case:

while 1

if $a < 5 and $b = 1 then

mouseclick("windowtitle", "windowtext", "buttonXYZ")

elseif $a > 5 and $b = 0 then

mouseclick("windowtitle", "windowtext", "buttonXYZ")

elseif someothercondition

EXIT

else

EXIT

endif

WEND

the last elseif someothercondition and else use the exit command. Use only one of them. I dont know when you want to exit.

If u decide to put this in a function, you can also say return instead of exit and it will exit the funtion and go on to the next commend (if no other commend it will exit the script).

Hope it helps

Ennis

Posted

Replace "stop"with "exit".

You can nest loops and you can nest Select... Case and If... Then statements.

I'll convert your code into AutoIt syntax.

If ($a < 5 and $b = 1) OR ($a>5 and $b=0) then
   press($buttonXYZ)  ;This can be a call to a userdefined function or a Send(), or MouseClick()
   EXIT
EndIf
Posted

SlimShady

So if I am to understand right - basically it checks the condition, if one of the two conditions is matched, then "EXIT" will cause the script to end at that point?

Thanks for the quick replies guys - really appreciate it.

Replace "stop"with "exit".

You can nest loops and you can nest Select... Case and If... Then statements.

I'll convert your code into AutoIt syntax.

If ($a < 5 and $b = 1) OR ($a>5 and $b=0) then
   press($buttonXYZ)  ;This can be a call to a userdefined function or a Send(), or MouseClick()
   EXIT
EndIf

<{POST_SNAPBACK}>

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
  • Recently Browsing   0 members

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