The following snippet checks 768 different pixels to see if the color at each spot matches one of 78 colors stored in 78 variables. The variables are declared at the beginning of the script. The scrip is writing the exact number of entries to the textfile every time.HC1-HC78 represent the colors. I know for a fact that colors 1-78 should match the sampled color using GetPixelColor, yet it is still writing 768 entries to file as if none of the colors match. The entries it is writing even verify that SCCc has matched the declared variables many times during the 768 checks.
Label>Start
//it adds one to sccX until sccX reaches the max of zone and then it resets sccX and then adds one to sccY.
GetPixelColor>%sccX%,%sccY%,SCCc
If>(%SCCc%=%HC1%) or (%SCCc%=%HC2%) or (%SCCc%=%HC3%) or (%SCCc%=%HC4%) or (%SCCc%=%HC5%) or (%SCCc%=%HC6%) or (%SCCc%=%HC7%) or (%SCCc%=%HC8%) or (%SCCc%=%HC9%) or (%SCCc%=%HC10%) or (%SCCc%=%HC11%) or (%SCCc%=%HC12%) or (%SCCc%=%HC13%) or (%SCCc%=%HC14%) or (%SCCc%=%HC15%) or (%SCCc%=%HC16%) or (%SCCc%=%HC17%) or (%SCCc%=%HC18%) or (%SCCc%=%HC19%) or (%SCCc%=%HC20%) or (%SCCc%=%HC21%) or (%SCCc%=%HC22%) or (%SCCc%=%HC23%) or (%SCCc%=%HC24%) or (%SCCc%=%HC25%) or (%SCCc%=%HC26%) or (%SCCc%=%HC27%) or (%SCCc%=%HC28%) or (%SCCc%=%HC29%) or (%SCCc%=%HC30%) or (%SCCc%=%HC31%) or (%SCCc%=%HC32%) or (%SCCc%=%HC33%) or (%SCCc%=%HC34%) or (%SCCc%=%HC35%) or (%SCCc%=%HC36%) or (%SCCc%=%HC37%) or (%SCCc%=%HC38%) or (%SCCc%=%HC39%) or (%SCCc%=%HC40%) or (%SCCc%=%HC41%) or (%SCCc%=%HC42%) or (%SCCc%=%HC43%) or (%SCCc%=%HC44%) or (%SCCc%=%HC45%) or (%SCCc%=%HC46%) or (%SCCc%=%HC47%) or (%SCCc%=%HC48%) or (%SCCc%=%HC49%) or (%SCCc%=%HC50%) or (%SCCc%=%HC51%) or (%SCCc%=%HC52%) or (%SCCc%=%HC53%) or (%SCCc%=%HC54%) or (%SCCc%=%HC55%) or (%SCCc%=%HC56%) or (%SCCc%=%HC57%) or (%SCCc%=%HC58%) or (%SCCc%=%HC59%) or (%SCCc%=%HC60%) or (%SCCc%=%HC61%) or (%SCCc%=%HC62%) or (%SCCc%=%HC63%) or (%SCCc%=%HC64%) or (%SCCc%=%HC65%) or (%SCCc%=%HC66%) or (%SCCc%=%HC67%) or (%SCCc%=%HC68%) or (%SCCc%=%HC69%) or (%SCCc%=%HC70%) or (%SCCc%=%HC71%) or (%SCCc%=%HC72%) or (%SCCc%=%HC73%) or (%SCCc%=%HC74%) or (%SCCc%=%HC75%) or (%SCCc%=%HC76%) or (%SCCc%=%HC77%) or (%SCCc%=%HC78%)
Goto>SCCStartX1
else
Let>k=%k%+1
WriteLn>MY PATH WORKS FINE\file.txt,r,%SCCc%
Goto>Start
endif
Why is the IF statement not working properly?
IF statement syntax
Moderators: Dorian (MJT support), JRL
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
-
- Newbie
- Posts: 12
- Joined: Mon Mar 10, 2008 6:26 pm
-
- Newbie
- Posts: 12
- Joined: Mon Mar 10, 2008 6:26 pm
Found it. What a pain. I had called a variable named HC31 however, in my declarations above, This variable did not exist. I had named it HC21 instead of 31. All is well now.
It would be great to have a feature that told you when your error is variable related instead of saying "( is expected" or "% not expected"
It would be great to have a feature that told you when your error is variable related instead of saying "( is expected" or "% not expected"
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
There are a number of tools available in Macro Scheduler to help you troubleshoot your code.
Here's a beginning list ......
You can single step through your code, and you can watch your variable values and you can insert breakpoints, and you can look at log files, and you can insert message boxes, and you can ............
Here's a beginning list ......
You can single step through your code, and you can watch your variable values and you can insert breakpoints, and you can look at log files, and you can insert message boxes, and you can ............
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!