Complex expression not resolving

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
AntoniusMomac
Junior Coder
Posts: 20
Joined: Fri Dec 07, 2007 7:46 am
Location: New York City, NY

Complex expression not resolving

Post by AntoniusMomac » Wed Sep 10, 2008 8:52 pm

Hello guys,

I was wondering if any body knows why the following code works:

Code: Select all

 if>%SearchScreenLARGE% = "Done"
  Message>OKay
  Endif
  if>%CheckForIMG% = "GOT_IT"
  Message>OKay
  Endif
But, this code only works if the variables SearchScreenLARGE and CheckForIMG exist. Am I doing something wrong?

Code: Select all

 If>{(%SearchScreenLARGE% = "Done") AND (%CheckForIMG% = "GOT_IT")}
  //do Something
  Endif
I'm okay if I first call the other function which initializes the 2 variables; however, the point of the check is to verify if the other function has been run.

however the workaround is the 2 step check.

But if anyone has any ideas, please clue me in.

Many thanks in advance.
Love Simple!! "Simplicity means the achievement of maximum effect with minimum means" - Dr. Koichi Kawana, Architect, designed the botanical gardens

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Sep 10, 2008 10:23 pm

In Macro Scheduler quotes and spaces are seen as text except in complex expressions. In complex expressions quotes are required around text and spaces are ignored. Spaces can be ignored always if the system variable IGNORSPACES is set to 1 (one).

Let>IGNORSPACES=1

That said, the syntax of your first If> example is wrong and does not work as you want it to work because it has spaces and quotes. However, it does not fail because Macro Scheduler sees it either as a comparison of the text "%SearchScreenLARGE% " to the text " "Done"" when SearchScreenLARGE has no value assigned to it. Or, when SearchScreenLARGE has a value, the comparison is between the value of SearchScreenLARGE and the text " "Done"". In either case the test is valid so the line of script validates and there is no failure.

The complex expression is different. It fails because the variables are explicitly defined as variables by placing percents around them. If SearchScreenLARGE has not been assigned a value, then it is not a variable and the complex expression fails.

Try the following example. It uses the Assigned> function to test the expressions to see if they are variables or are just text.

Code: Select all

  //Let>SearchScreenLARGE=Done
  //Let>CheckForIMG=GOT_IT

Assigned>SearchScreenLARGE,SSL
Assigned>CheckForIMG,CFI
  If>{(%SSL%="TRUE")AND(%CFI%="TRUE")}
    If>{(%SearchScreenLARGE%="Done")AND(%CheckForIMG%="GOT_IT")}
    //do Something
    Endif
  EndIf

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