Moving Mouse To Non-Standard Windows Control

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Rips
Newbie
Posts: 4
Joined: Tue Jan 29, 2008 11:36 pm

Moving Mouse To Non-Standard Windows Control

Post by Rips » Fri Feb 01, 2008 3:34 am

Hi there, this is my first post so sorry if this seems like a silly question.

I am having a small issue trying to setup a macro that moves in and out of various dialogs. My issue is that a lot of the controls (e.g. Toolbar, OK button, etc) are custom controls and don't appear under the View System Windows dialog.

When I use the MouseOver or the PushButton functions, nothing happens.
Is there some other way I should be trying to access these controls?

Thanks,


Nige

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

Post by Marcus Tettmar » Mon Feb 04, 2008 8:05 am

Use Image Recognition. Use the FindImagePos command. Capture the control to a bitmap and then have FindImagePos find it's X,Y position on the screen and move the mouse to it. See the example scripts, examples in the help file and here in the forum. Also see:
http://www.mjtnet.com/blog/2007/02/20/h ... cognition/

Using this technique you can find and control ANY object on the screen regardless of what kind of control it is. It could even be a button inside a remote X-Windows terminal.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Rips
Newbie
Posts: 4
Joined: Tue Jan 29, 2008 11:36 pm

Post by Rips » Wed Feb 06, 2008 6:01 am

I thought of using this function, but the toolbar items are on a gradient background. Also, the toolbar can run down the side of the screen or along the top of the screen. Depending on how the user has their toolbar setup, changes the gradient direction (hence changes the image). Do you suggest maybe taking an image of both toolbar items and using an if statement to find one or the other?

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

Post by Marcus Tettmar » Wed Feb 06, 2008 1:32 pm

Yes, capture each possibility and test for each one.
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