FindImagePos problem

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
dglancy
Newbie
Posts: 12
Joined: Mon Aug 09, 2004 4:39 pm

FindImagePos problem

Post by dglancy » Thu Jul 03, 2008 3:40 pm

I am using MS ver 9.2.01
Starting MS Access in Citrix.
My goal is to use FindImagePos to locate upper left hand corner of MS Access title to then maximize the window.

With the MS Access window at max, I select a needle of the upper left hand corner and save the bitmap.
FindImagePos will find this bitmap if Access is maximized but will not find it if Access is not maximized.
I have reversed this process by creating a bitmap of the upper left hand corner of the Access window when it is not maximized.
FindImagePos will not find the new bitmap on the Access maximized window but will find it when the Access window is not maximized.

I have been conservation on selecting an image and have used Paint at 800% to view the selected image.

Here is the code I am using to check for the image under max/min windows

thanks for the help

Code: Select all

label>check_again
GetScreenRes>Sx,Sy
wait>1
ScreenCapture>0,0,Sx,Sy,G:\AB Brown\ABBSCR\Macro Scheduler 1\BMPs\Avantis\screen.bmp
FindImagePos>G:\AB Brown\ABBSCR\Macro Scheduler 1\BMPs\Avantis\Access_Open_b.bmp,G:\AB Brown\ABBSCR\Macro Scheduler 1\BMPs\Avantis\screen.bmp,5,1,X,Y,imgs_a
if>imgs_a>0
		 MessageModal>%imgs_a%, Avantis
		 let>direct=G:\AB Brown\ABBSCR\Macro Scheduler 1\BMPs\Avantis\
		 MouseMove>X_0,Y_0
		 else
		MessageModal>%imgs_a%, Avantis
endif
goto>check_again

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

Post by Marcus Tettmar » Thu Jul 03, 2008 3:56 pm

The image must be different in each case. When maximised you won't see part of the border. So you need to capture a part of the title bar which does not change between restored and maximised.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

dglancy
Newbie
Posts: 12
Joined: Mon Aug 09, 2004 4:39 pm

Post by dglancy » Thu Jul 03, 2008 5:17 pm

I am capturing just part of the title icon and part of the title letters. In fact, I have also taken a subset of the images to be found using Paint at 800% zoom. I get the same result with these bitmaps.

correction !!

By continuing to edit/reduce the bitmaps from the upper right and lower left, I have found one that will work.

I am surprised at how much the title bar changes from max to restore. The bitmaps started at 7K bytes to a final at 1K to get it to work.

Thanks again.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Jul 05, 2008 4:57 pm

Rather than using images to check for miximum window, how about using GetActiveWindow to check Width and Height. If both are correct then check that X,Y are 0,0
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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