Problem with variable

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
jm
Newbie
Posts: 2
Joined: Mon Jun 25, 2012 6:46 pm

Problem with variable

Post by jm » Mon Jun 25, 2012 6:55 pm

Hello,
I have some problems with a variable in the script.
I want to make a script with two choices.
the choices will need to be made ​​within the program, the way it should be chosen depends on the background of how the program looks like, if a certain image appears, the script must perform a different action. I was so, but this script does not work I like to see your improved input.

//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1


Wait>2


Let>FIP_SCANPIXELS=ALL
FindImagePos>%SCRIPT_DIR%\Win_2.bmp,SCREEN,0,1,XArr,YArr,NumFound
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Wait>2
MouseMove>560,632
Else>NumFound>1
MouseMove>363,647
Wait>2
LClick
Mousemove>550,462
LClick
MouseMove>560,641
LClick

Endif

thanks.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Mon Jun 25, 2012 9:36 pm

For a start the conditionals need to be re-defined. As you have them now the code will never get to the Else because any number that is greater than 1 is greater than zero so the first condition is met and then it's all over.

If>NumFound>0
Else>NumFound>1

jm
Newbie
Posts: 2
Joined: Mon Jun 25, 2012 6:46 pm

Post by jm » Tue Jun 26, 2012 6:22 am

Thanks for your response.

How do I redefine the conditions? so `` as `` an equal chance as `` else ``?
And that eventually only one of these options is performed?

Thank you.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jun 26, 2012 9:33 am

Aside from the syntax error your code seems to be saying "if more than zero results is found (i.e. if 1 or more results) do something, else if more than one is found do something else".

Since the second condition is also matched by the first condition (more than 1 is logically the same as more than 0) the second statement will never be met.

But Else>NumFound>1 is incorrect syntax anyway.

I think you need to tell us what it is that you want to do, and what conditions you want to check for, because your code doesn't tell us.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts