Hey all
Please let me know what i am doing wrong
i have the code below Searching for the image on screen below
i get the Correct strText var in the Messagemodal>strText
but when i run this if statement
i keep getting no.
OCRArea>20,109,94,127,strText
Messagemodal>strText
/If>strText=Showing 50
If>(%strText%="Showing 50")
Message>yes
Else
Message>no
endif
have tried also:
/If>%strText%=Showing 50
/If>strText="Showing 50"
/If>%strText%="Showing 50"
/If>(%strText%="Showing 50")
thank you
OCR Area giving correct Var but If not working!
Moderators: Dorian (MJT support), JRL
-
- Junior Coder
- Posts: 24
- Joined: Thu Oct 11, 2018 1:19 pm
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: OCR Area giving correct Var but If not working!
Put the string to clipboard and paste it into Notepad++ just to make sure it's exactly what you think it is. It might be some hidden values?
-
- Junior Coder
- Posts: 24
- Joined: Thu Oct 11, 2018 1:19 pm
Re: OCR Area giving correct Var but If not working!
Hey
Cheers for the reply,
I had done what you suggested,
and used a different area/image to capture
This is the image i captured: Again in the MessageModal>var result i get:55.18, 55.92
and the same when i clipboard and Ctrl/v (past) in the result
but when i do a if statement, no matter what the captured strText result is it always returns,
MessageModal>yes
I dont understand what im doing wrong.
the values specified are different then the result in the strText
Label>start
OCRArea>50,935,210,969,strText
MessageModal>strText
If>strText=55.06, 55.25
Message>yes
else
Message>no
Wait>2
Endif
/PutClipBoard>strText
This is my first attempts at doing OCR Image/Area and so far i can only get the strText to match but i cant get If Statements to work.
and i do need this to work!
all the code looks to work out in theory but on execution not so well.
i wont be able to make accurate algorithms if i cant get the simple OCR to work in MS
I hope someone can help me debug my issue.
or atlease try doing OCR on the image posted and have the strText be 55.18, 55.92 (as it should) and try doing the above If> and let me know how it runs.
thank you for your time
and cheers!
Cheers for the reply,
I had done what you suggested,
and used a different area/image to capture
This is the image i captured: Again in the MessageModal>var result i get:55.18, 55.92
and the same when i clipboard and Ctrl/v (past) in the result
but when i do a if statement, no matter what the captured strText result is it always returns,
MessageModal>yes
I dont understand what im doing wrong.
the values specified are different then the result in the strText
Label>start
OCRArea>50,935,210,969,strText
MessageModal>strText
If>strText=55.06, 55.25
Message>yes
else
Message>no
Wait>2
Endif
/PutClipBoard>strText
This is my first attempts at doing OCR Image/Area and so far i can only get the strText to match but i cant get If Statements to work.
and i do need this to work!
all the code looks to work out in theory but on execution not so well.
i wont be able to make accurate algorithms if i cant get the simple OCR to work in MS
I hope someone can help me debug my issue.
or atlease try doing OCR on the image posted and have the strText be 55.18, 55.92 (as it should) and try doing the above If> and let me know how it runs.
thank you for your time
and cheers!
- Marcus Tettmar
- Site Admin
- Posts: 7394
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: OCR Area giving correct Var but If not working!
The comma in the value is being seen as a new parameter (If can take a true label and false label parameter).
Try this:
If>strText={"55.18, 55.92"}
Or:
Let>compare_to=55.18, 55.92
If>strText=compare_to
Try this:
If>strText={"55.18, 55.92"}
Or:
Let>compare_to=55.18, 55.92
If>strText=compare_to
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?
-
- Junior Coder
- Posts: 24
- Joined: Thu Oct 11, 2018 1:19 pm
Re: OCR Area giving correct Var but If not working!
(eye's Glistening at the sight of) If>strText={"55.18, 55.92"}
haha havent even tried it yet but looks like what i need.
Marcus,
Cheers bro
P.s,
Btw a big Thanks to:
Marcus & Dorian (and all others on the forum)
MC has helped me learn programming at a Increasing rate. only been using MC Since 11-Oct-2018
it has enabled me to have a decent grasp on reading programming languages in general and i am also learning
Python With (pycharm ide)
so far every problem i have ran into i have been able to work out (with the support of you guys) there are some other topics i have posted and hope some people will attend to them if they can.
i do have some things written but have 1 or 2 things missing or even just Syntax that needs tweaking
ill post them up soon.
anyways cheers!
haha havent even tried it yet but looks like what i need.
Marcus,
Cheers bro
P.s,
Btw a big Thanks to:
Marcus & Dorian (and all others on the forum)
MC has helped me learn programming at a Increasing rate. only been using MC Since 11-Oct-2018
it has enabled me to have a decent grasp on reading programming languages in general and i am also learning
Python With (pycharm ide)
so far every problem i have ran into i have been able to work out (with the support of you guys) there are some other topics i have posted and hope some people will attend to them if they can.
i do have some things written but have 1 or 2 things missing or even just Syntax that needs tweaking
ill post them up soon.
anyways cheers!