Could we add an argument to all image/text recognition commands to specify in which window to look for the image/text? Most of the time, we know exactly in which window to look for.
The need for this is sometimes it pick the wrong image from the desktop or from other windows that looked similar. With the ability to specify which window to look into, the accuracy will be increased tremendously.
Thanks and keep up the awesome work you guys are doing with this product!
Improvements to image/text recognition commands
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
That can already be done.
Look at the Google Button Example that comes with Macro Scheduler. It searches ONLY the browser window:
//Get bounds of window
GetActiveWindow>title,X,Y,W,H
//Capture the IE Window to a bitmap
IfFileExists>%SCRIPT_DIR%\screen.bmp
DeleteFile>%SCRIPT_DIR%\screen.bmp
EndIf
ScreenCapture>X,Y,{%X%+%W%},{%Y%+%H%},%SCRIPT_DIR%\screen.bmp
//I used the capture tool to make googlebutton.bmp and saved it in the script folder
FindImagePos>%SCRIPT_DIR%\googlebutton.bmp,%SCRIPT_DIR%\screen.bmp,20,1,XArr,YArr,imgs
Notice it is only searching inside the IE window, not the full screen.
Look at the Google Button Example that comes with Macro Scheduler. It searches ONLY the browser window:
//Get bounds of window
GetActiveWindow>title,X,Y,W,H
//Capture the IE Window to a bitmap
IfFileExists>%SCRIPT_DIR%\screen.bmp
DeleteFile>%SCRIPT_DIR%\screen.bmp
EndIf
ScreenCapture>X,Y,{%X%+%W%},{%Y%+%H%},%SCRIPT_DIR%\screen.bmp
//I used the capture tool to make googlebutton.bmp and saved it in the script folder
FindImagePos>%SCRIPT_DIR%\googlebutton.bmp,%SCRIPT_DIR%\screen.bmp,20,1,XArr,YArr,imgs
Notice it is only searching inside the IE window, not the full screen.
Last edited by Marcus Tettmar on Thu Jul 30, 2009 7:37 pm, edited 1 time in total.
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?
Just tried this,
GetActiveWindow returns x,y,height,width.
ScreenCapture needs x(top),Y(top),x(Bottom),Y(Bottom)
shouldn't it be
--------------------------------------------------------------------
GetActiveWindow>title,X,Y,W,H
//Capture the IE Window to a bitmap
IfFileExists>%SCRIPT_DIR%\screen.bmp
DeleteFile>%SCRIPT_DIR%\screen.bmp
EndIf
Let>W=W+X
Let>H=H+Y
ScreenCapture>X,Y,W,H,%SCRIPT_DIR%\screen.bmp
//I used the capture tool to make googlebutton.bmp and saved it in the script folder
FindImagePos>%SCRIPT_DIR%\googlebutton.bmp,%SCRIPT_DIR%\screen.bmp,20,1,XArr,YArr,imgs
--------------------------------------------------------------------
GetActiveWindow returns x,y,height,width.
ScreenCapture needs x(top),Y(top),x(Bottom),Y(Bottom)
shouldn't it be
--------------------------------------------------------------------
GetActiveWindow>title,X,Y,W,H
//Capture the IE Window to a bitmap
IfFileExists>%SCRIPT_DIR%\screen.bmp
DeleteFile>%SCRIPT_DIR%\screen.bmp
EndIf
Let>W=W+X
Let>H=H+Y
ScreenCapture>X,Y,W,H,%SCRIPT_DIR%\screen.bmp
//I used the capture tool to make googlebutton.bmp and saved it in the script folder
FindImagePos>%SCRIPT_DIR%\googlebutton.bmp,%SCRIPT_DIR%\screen.bmp,20,1,XArr,YArr,imgs
--------------------------------------------------------------------
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Yes, correct. Well spotted. Post updated.
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?