Improvements to image/text recognition commands

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
lqn_2003
Newbie
Posts: 4
Joined: Wed Sep 20, 2006 11:25 pm

Improvements to image/text recognition commands

Post by lqn_2003 » Fri Oct 17, 2008 7:22 pm

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!

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

Post by Marcus Tettmar » Fri Oct 17, 2008 8:41 pm

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.
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?

Trautmann
Newbie
Posts: 9
Joined: Fri Jun 12, 2009 6:35 pm

Post by Trautmann » Thu Jul 30, 2009 6:50 pm

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


--------------------------------------------------------------------

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

Post by Marcus Tettmar » Thu Jul 30, 2009 7:37 pm

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?

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