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?
WaitScreenImage does not work?
Moderators: JRL, Dorian (MJT support)
WaitScreenImage does not work?
Last edited by Rapid1898 on Thu Oct 31, 2013 12:05 pm, edited 1 time in total.
- Phil Pendlebury
- Automation Wizard
- Posts: 543
- Joined: Tue Jan 16, 2007 9:00 am
- Contact:
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.
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
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
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.
- Phil Pendlebury
- Automation Wizard
- Posts: 543
- Joined: Tue Jan 16, 2007 9:00 am
- Contact:
Try:
Or
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.
Code: Select all
WaitScreenImage>H:\Dropbox\Backup Daten\Macro Scheduler\Click Here.bmp,0.7,CCOEFF
Code: Select all
WaitScreenImage>H:\Dropbox\Backup Daten\Macro Scheduler\Click Here.bmp,50,EXACT
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