FindImagePos & WaitScreenImage

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
scorpionida
Newbie
Posts: 6
Joined: Mon Sep 22, 2008 7:16 am

FindImagePos & WaitScreenImage

Post by scorpionida » Mon Sep 22, 2008 7:37 am

my macro is

FindImagePos>D:\Netcad_Gui_Test\Macro_Images\ortak\ac_icon.bmp,SCREEN,80,0,acX,acY,acN
if>acN>0
MouseMove>acX_0,acY_0
LClick
endif

but at the same macro can not find ac_icon or some bmp's

and i have a other problem on image recogniting in

Let>WSI_TIMEOUT=105
WaitScreenImage>D:\Netcad_Gui_Test\Macro_Images\ortak\hazir.bmp,80

this macro is not wait the bmp. Macro continue before time out value.

Can you help me ??

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

Post by Marcus Tettmar » Mon Sep 22, 2008 8:03 am

- How did you create the needle images? Make sure you used Macro Scheduler's own Image Capture tool.

- What is the value of acN. Did it fine none or many?

- What is the size of the needle image? Is there much background? If the image is not very unique, then a sample of pixels may be shared amongst other possible matches. Circumvent this by either increasing FIP_SCANPIXELS or making the image smaller/tighter/more "unique".

- Are you sure you're calling these functions at the right time?

- For diagnostics use ScreenCapture prior to your FindImagePos/WaitScreenImage calls. Then we can see the screen as Macro Scheduler saw it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

scorpionida
Newbie
Posts: 6
Joined: Mon Sep 22, 2008 7:16 am

Post by scorpionida » Mon Sep 22, 2008 8:30 am

I create these images from FindImagesPos's Capture Method. Images are unique acN is FindImagesPos's Num Found Var value and it uses just one time on code 62x15 is image's size.

and Yes i am sure to calling function at right time i use these code nearly 10 macros but, when waitscreenimage method is not wait when screen changing for example
i give 5 min (in secconds) to time out but its continue after 4 min and i give over than 5 min but it doesnt work my macro must to wait for these image nearly 10 min and it never wait. because of that i use Wait code but its not a good way of Automation.

idiot
Macro Veteran
Posts: 152
Joined: Thu Mar 01, 2007 9:21 am

Post by idiot » Mon Dec 08, 2008 8:31 pm

first off from what im understanding this is only a bit of code from a full script if you show us full script we can help a bit morealso why not use a loop for finding image instead of using wait

like
label>findimagestart
if>find image
do something
else>
goto>findimagestart

--------------------------------------------------------
"if your trying to do multiple things with script you can use a nested loop instead of wait aswell "
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

color tolerance too high?

Post by gdyvig » Mon Dec 08, 2008 11:58 pm

Perhaps your WaitScreenImage color tolerance of 80 is too high, you may be getting a false match.

Try this experiment: Use FindImagePos with the same color tolerance in a loop where your move the mouse, wait a second. Repeat the loop many times. If your color tolerance is too high, the mouse will move around the screen on various false matches.

Hope this helps.

Gale

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Post by gdyvig » Tue Dec 09, 2008 4:46 pm

I was thinking about my previous post.

Too low of a FIP_SCANPIXELS setting (much less than number of pixesl in needle file) may cause mouse to move around if you do the look I suggested. That is because there may be many areas on the screen that are a close enough match.

Too high of a color tolerance may also cause WaitScreenImage and FindImagePos to find many matches thus increasing the chances of finding a different image location for each command invocation where FIP_SCANPIXELS is less than the image size.

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

Post by Marcus Tettmar » Tue Dec 09, 2008 4:49 pm

Rather than make the mouse move around, just use the debugger and view the num found variable value. Or put it into a message box:

FimdImagePos>img,SCREEN,80,0,acX,acY,acN
MessageModal>acN

If acN is zero it hasn't found anything. If it is more than 1 it has found more than 1 potential matches. If it has found LOTS then it could be that either you need to increase FIP_SCANPIXELS, your color tolerance is too high, and/or the image is not defined enough.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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