WaitScreenImage does not work?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Rapid1898
Newbie
Posts: 5
Joined: Sun Oct 27, 2013 8:44 pm

WaitScreenImage does not work?

Post by Rapid1898 » Thu Oct 31, 2013 7:05 am

Hallo,

i try to use the "WaitScreenImage" function - but it doesn´t work... - regardless of wheter i have a screen with or without the bmp on it - the variable WSI-RESULT is allways 1...

This is the code:
WaitScreenImage>H:\Dropbox\Backup Daten\Macro Scheduler\Click Here.bmp,0,CCOEFF
MessageModal>%WSI_RESULT%

This is the BMP i want to look for:
http://img5.fotos-hochladen.net/uploads ... em0sjf.jpg

This is a screen i would like to find - so the WSI-RESULT should be 1:
http://img5.fotos-hochladen.net/uploads ... mnpc6h.jpg

And this is a screen where the BMP ist not there - so the WSI-RESULT should be 0
http://img5.fotos-hochladen.net/uploads ... 4afbmp.jpg

Why ist the WSI-RESULT allways 1...?
Is my handling in anyway false?
Or is this function not possible with the trial version i am currently using?
Last edited by Rapid1898 on Thu Oct 31, 2013 12:05 pm, edited 1 time in total.

User avatar
Phil Pendlebury
Automation Wizard
Posts: 543
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Post by Phil Pendlebury » Thu Oct 31, 2013 7:48 am

This is most likely because you have tolerance set to 0 which will find pretty much anything. I cannot test precisely because your screen grabs are very low res.

Admittedly this is kind of a fault of the code builder which I presume you used, as it inserts this by default.

Suggestions: Code Builder change default to 0.7

For your code, also try 0.7 instead of 0 and read manual about tolerance. Search for "FindImagePos" should get you to the part in the manual that you need.

Also if you want to be more precise try NOT using CCOEFF.
Phil Pendlebury - Linktree

Rapid1898
Newbie
Posts: 5
Joined: Sun Oct 27, 2013 8:44 pm

Post by Rapid1898 » Thu Oct 31, 2013 8:42 am

Thank you very much for your tipps.

I tried several things - but nothing works...

Tried to do it without CCOEFF:
Let>WSI_TIMEOUT=2
WaitScreenImage>H:\Dropbox\Backup Daten\Macro Scheduler\Click Here.bmp,0
MessageModal>%WSI_RESULT%

=> WSI_RESULT is allways not found (=0) - regardless wheter i am using 0 or 0.7. or 1 as tolerance-setting


Tried it with CCOEFF an different tolerance settings:
Let>WSI_TIMEOUT=2
WaitScreenImage>H:\Dropbox\Backup Daten\Macro Scheduler\Click Here.bmp,1,CCOEFF
MessageModal>%WSI_RESULT%

=> When i set the tolerance to 1 WSI_RESULT is allways not found (=0) regardless if the BMP is there or not
=> When i set the tolerance to 0.7 or 0 WSI_RESULT is allways FOUND (=1) regardless if the BMP is there or not


In the following picture you can see the exact cursour position where the program thinks the BMP ist found (is used the XArr and YArr variables to found this):
http://img5.fotos-hochladen.net/uploads ... yi4duq.jpg
Last edited by Rapid1898 on Thu Oct 31, 2013 12:05 pm, edited 1 time in total.

User avatar
Phil Pendlebury
Automation Wizard
Posts: 543
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Post by Phil Pendlebury » Thu Oct 31, 2013 9:08 am

Try:

Code: Select all

WaitScreenImage>H:\Dropbox\Backup Daten\Macro Scheduler\Click Here.bmp,0.7,CCOEFF
Or

Code: Select all

WaitScreenImage>H:\Dropbox\Backup Daten\Macro Scheduler\Click Here.bmp,50,EXACT
Adjust tolerance accordingly.

Also your time out is very low. That is only giving 2 seconds to scan the entire screen. Depending on size of screen and speed of CPU it may take longer. I would try without any timeout to start off with and then test something like this:

Sorry did an animated GIF for you but no way to post it here.
Phil Pendlebury - Linktree

Rapid1898
Newbie
Posts: 5
Joined: Sun Oct 27, 2013 8:44 pm

Post by Rapid1898 » Thu Oct 31, 2013 12:04 pm

With this line
WaitScreenImage>H:\Dropbox\Backup Daten\Macro Scheduler\Click Here.bmp,50,EXACT

and a timeout with 3sec everything seems to work fine.

Thank you very much!

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