http://www.perlmonks.org?node_id=399291


in reply to Usin Win32::GuiTest to remove printers.

If you mean not good programming as in it looks clumsy and delicate, then I agree, however Windows apps are often built in such a way that this is the only approach. What I do in these cases is make it as robust as possible with what the original app designer gave you.

For instance, to jump to a particular edit box, you can use SendKeys("{ALT}f");. This should put your cursor in the File: edit box, based on the child names you found (listing all the children is always a good starting point in my experience). Similarly you can press a button using the assigned alt-key sequence.

Tabbing is also handy for moving between fields, especially if you can go directly to one field using an alt-key sequence, then count tabs from there. Beware that it is not uncommon for the tab sequences to be nonsensical (where the original designer rearranged his widgets on screen without re-sequencing the tabs), and sometimes edit boxes are not in the tab list at all. When that happens, I've resorted to locating the mouse pointer and then clicking it to move the cursor into the required box. Yes it's messy, but it works... so long as the target application is not upgraded!

Good luck!

--
I'd like to be able to assign to an luser