syntax error
Moderators: Dorian (MJT support), JRL
-
- Pro Scripter
- Posts: 50
- Joined: Thu Feb 21, 2008 9:11 pm
syntax error
I'm using the FindIamgePos command
FindImagePos>C:\ocr\openseat.bmp,SCREEN,60,1,x,y,NumFound
Normally to return the x coordinate of the first occurence found you
use:
%x_0%
But I am running into difficulty when I want to look at the coordinates in
succession. How do I replace %x_0%, %x_1% , %x_2% etc with a variable?
I tried the following 3 combinations and all of them produced errors
Let>i=-1
Repeat>i
Let>i=i+1
let>z=%x_%i%%
Until>i,NumFound
Let>i=-1
Repeat>i
Let>i=i+1
let>z=%x%_%i%
Until>i,NumFound
Let>i=-1
Repeat>i
Let>i=i+1
let>z=%%x%_%i%%
Until>i,NumFound
Thank you for your help
FindImagePos>C:\ocr\openseat.bmp,SCREEN,60,1,x,y,NumFound
Normally to return the x coordinate of the first occurence found you
use:
%x_0%
But I am running into difficulty when I want to look at the coordinates in
succession. How do I replace %x_0%, %x_1% , %x_2% etc with a variable?
I tried the following 3 combinations and all of them produced errors
Let>i=-1
Repeat>i
Let>i=i+1
let>z=%x_%i%%
Until>i,NumFound
Let>i=-1
Repeat>i
Let>i=i+1
let>z=%x%_%i%
Until>i,NumFound
Let>i=-1
Repeat>i
Let>i=i+1
let>z=%%x%_%i%%
Until>i,NumFound
Thank you for your help
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Actually you shouldn't be using %x_0%
Do it like this:
Do it like this:
Code: Select all
Let>i=0
Repeat>i
Let>x=x_%i%
Let>y=y_%i%
MouseMove>x,y
LClick
Let>i=i+1
Until>i=NumFound
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
The correct syntax is:
Let>i=-1
Repeat>i
Let>i=i+1
let>z=x_%i%
Until>i,NumFound
I want to caution you against using single characters as variable names. The practice will eventually cause you problems. I would prefer you do something like:
Let>kk=-1
Repeat>kk
Let>kk=kk+1
let>value=x_%kk%
Until>kk,NumFound
Let>i=-1
Repeat>i
Let>i=i+1
let>z=x_%i%
Until>i,NumFound
I want to caution you against using single characters as variable names. The practice will eventually cause you problems. I would prefer you do something like:
Let>kk=-1
Repeat>kk
Let>kk=kk+1
let>value=x_%kk%
Until>kk,NumFound
-
- Pro Scripter
- Posts: 50
- Joined: Thu Feb 21, 2008 9:11 pm
I forgot to include that attempt in my post ,I but I did tried that also, and got an error
Let>i=-1
Repeat>i
Let>i=i+1
here is my line of code
If>{(x_%i% > 514) AND (x_%i% 65) AND (y_%i%i,NumFound
I get an error that say unknown identifier x_0 on that line.
Zero is correct for i on the first pass but i get an error.
Let>i=-1
Repeat>i
Let>i=i+1
here is my line of code
If>{(x_%i% > 514) AND (x_%i% 65) AND (y_%i%i,NumFound
I get an error that say unknown identifier x_0 on that line.
Zero is correct for i on the first pass but i get an error.
Last edited by SuitedAces on Tue Feb 26, 2008 8:09 pm, edited 1 time in total.
You probably need to remove the spaces from the if> line. Unless you have the variable IGNORSPACES set to 1
Because of the rules for complex expressions you will need to pre_capture the value of the array variables to a non array variable. Something like:
Because of the rules for complex expressions you will need to pre_capture the value of the array variables to a non array variable. Something like:
Code: Select all
Let>kk=-1
Repeat>kk
Let>kk=kk+1
let>value_X=x_%kk%
let>value_Y=y_%kk%
If>{(%value_X%>514)AND(%value_X%<534)AND(%value_Y%<85)}
Last edited by JRL on Tue Feb 26, 2008 8:13 pm, edited 1 time in total.
-
- Pro Scripter
- Posts: 50
- Joined: Thu Feb 21, 2008 9:11 pm
please look at my line of code again I needed to reenter it manully because when I pasted it , it jumbled up for some reason.JRL wrote:You probably need to remove the spaces from the if> line. Unless you have the variable IGNORSPACES set to 1
Because of the rules for complex expressions you will need to pre_capture the value of the array variables to a non array variable. Something like:
Code: Select all
Let>kk=-1 Repeat>kk Let>kk=kk+1 let>value_X=x_%kk% let>value_Y=y_%kk% If>{(%value_X%>514)AND(%value_X%<534>65)AND(%value_Y%<85>kk,NumFound
The form page would not accept a paste of my line of code.
????
That is bizarre
-
- Pro Scripter
- Posts: 50
- Joined: Thu Feb 21, 2008 9:11 pm
-
- Pro Scripter
- Posts: 50
- Joined: Thu Feb 21, 2008 9:11 pm
Ok I followed that advice and did it this way and still got an error.
Let>i=-1
Repeat>i
Let>i=i+1
FindImagePos>C:\ocr\openseat.bmp,SCREEN,60,1,x,y,NumFound
Let>a=x_%i%
Let>b=y_%i%
If>{(a>514)AND(a<534)AND(b<65)AND(b<85)}
I cannot complete the code on the forum ...it gets jumbled
(very bizarre)
but the important line is there
I get unknown identifier 'a'
Let>i=-1
Repeat>i
Let>i=i+1
FindImagePos>C:\ocr\openseat.bmp,SCREEN,60,1,x,y,NumFound
Let>a=x_%i%
Let>b=y_%i%
If>{(a>514)AND(a<534)AND(b<65)AND(b<85)}
I cannot complete the code on the forum ...it gets jumbled
(very bizarre)
but the important line is there
I get unknown identifier 'a'
-
- Pro Scripter
- Posts: 50
- Joined: Thu Feb 21, 2008 9:11 pm