Some questions about Image Recognition with Dialogs

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
totta_fadil
Newbie
Posts: 3
Joined: Sat Mar 09, 2019 1:30 pm

Some questions about Image Recognition with Dialogs

Post by totta_fadil » Mon Mar 11, 2019 10:53 am

Hi there everyone, I Hope you're all doing well.
First of all I'm new to MS World, and it's a great Language. So I need Help Since I'm a newbie.
I'm working on an Image recognition code which detect Images and Click on them, that's all my code do.
But now I want to Improve that, so that I can Control these IMagRec Lines with a Dialog,
What I want to do is to make some Check Boxes on the Dialog, which if (Checked) some of the Image-Searches are disabled.
then making a Start Buttom which Starts the Script to search for Only the desired Images.
my main Code is Like this:
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\Home.bmp,WINDOW:NoxPlayer,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Endif
label>start
RunProgram>D:\Program Files\.....\bin\Nox.exe
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\Game.bmp,WINDOW:NoxPlayer,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Endif
//Find and Double Left Click Center of
FindImagePos>%BMP_DIR%\Intro.bmp,WINDOW:NoxPlayer,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LDblClick
LDblClick
LDblClick
LDblClick
wait>1
LDblClick
LDblClick
LDblClick
Endif
I want the Check Box to "let's say" deactivate searching for the last Picture(s) if Checked ? is this possible ?
and can I do this for Multiple Pictures ? like if a Check Box is checked the Script Skips like 3-4 Image Search Lines ?
my event Handler for the check Box is like this.....
[/quote]
AddDialogHandler>Dialog1,CheckBox1,OnClick,CheckItems

Show>Dialog1,modalresult

SRT>CheckItems
GetDialogProperty>Dialog1,CheckItems,Checked,isChecked
here is what I want it do do which is Skipping searching for Image X, Y, Z???
END>CheckItems
[/quote]
any help would be appreciated....

totta_fadil
Newbie
Posts: 3
Joined: Sat Mar 09, 2019 1:30 pm

Re: Some questions about Image Recognition with Dialogs

Post by totta_fadil » Thu Mar 14, 2019 8:53 pm

can anyone help me ?....

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

Re: Some questions about Image Recognition with Dialogs

Post by Marcus Tettmar » Fri Mar 15, 2019 5:15 pm

For this example let's keep things simple and say you have two searches. For each one you have a checkbox. CheckBox1 and CheckBox2.

In your handler:

Code: Select all

GetDialogProperty>Dialog1,CheckBox1,Checked,isBox1Checked
GetDialogProperty>Dialog1,CheckBox2,Checked,isBox2Checked
Then in the rest of your code you can simply look at the value of isBox1Checked and isBox2Checked

Code: Select all

If>isBox1Checked=True
  FindImagePos>%BMP_DIR%\FirstCheck.bmp,WINDOW:NoxPlayer,0.7,1,XArr,YArr,NumFound,CCOEFF
  //bla bla
Endif

If>isBox2Checked=True
  FindImagePos>%BMP_DIR%\SecondCheck.bmp,WINDOW:NoxPlayer,0.7,1,XArr,YArr,NumFound,CCOEFF
  //bla bla
Endif
See how all we are doing is returning whether the checkbox is checked in isBox1Checked and isBox2Checked. These variables will contain True or False. So all we need now is an If condition to check whether these are True and IF they are then we can do our FindImagePos. If not, we don't do it. No different to checking ANY variable.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

totta_fadil
Newbie
Posts: 3
Joined: Sat Mar 09, 2019 1:30 pm

Re: Some questions about Image Recognition with Dialogs

Post by totta_fadil » Tue Mar 19, 2019 12:43 am

amazing....I'll try this now
another question though....How can I make the Script Run only when I press the (Run\Start) Button that I made in the dialog ? maybe by making all the script under a Label ? and then If the button is pressed the script Goto that Label ? right?
thanks again Marcus for your Help and the enlightenment.....

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