General Approach to Navigating Round a Window?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
johngccfc
Newbie
Posts: 10
Joined: Fri Dec 10, 2010 5:24 pm

General Approach to Navigating Round a Window?

Post by johngccfc » Sun Dec 12, 2010 10:12 pm

Hi All,

If I have a window which is a desktop app, (fully devoid of ALT keyboard shortcuts) and wish to do a number of tasks involving reading values, populating text boxes, moving round tabpages, navigating though datagrids and pressing a few buttons, what approach should i take?

Should almost every control have some kind of handle (name, instance) exposed for me to use (i.e. with setfocus) or should i be measuring everything with a view having my mouse moving all over?

Thanks

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

Post by Marcus Tettmar » Mon Dec 13, 2010 8:35 am

This really depends on the application in question and your own preferences. Various options exist for navigating around the window:

- using the Tab key to move from object to object (while there may be no ALT key shortcuts you should still be able to TAB from field to field. Use Space to select/deselect radio buttons etc - these are standard Windows keyboard controls).

- Use image recognition to wait for/find and identify the position of objects.

- Yes, if you want to be technical you can also use lower level Windows API functions and handles/class names.

As far as pulling data from the window is concerned again this will depend on the application and what it offers. If the text is selectable then a simple solution is just to use the clipboard - highlight the text send a CTRL-c to it and then use GetClipBoard to get the data to a variable. If that is not possible you may be able to use the text capture functions such as GetWindowTextEx, GetTextAtPoint and GetTextInRect. If that isn't possible (the text isn't "accessible") then you could try OCR.

There are no rules. You just need to experiment and find out what works for you and your application.
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