Click here to Skip to main content
15,847,077 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have been tasked with automating a clients existing app ("C_app" for the sake of clarity).
C_app consists of many child forms to accept data input (first name, last name and so on).
I have automated the opening of the C_app, Passed values for the logon, clicked the "Next" button, added waits as needed, used SendKeys.Send("%(o)").. SendKeys.Send("%(N)") and so on to get me to the data entry form in C_app.
I can loop through all the keys in the parent form and through each child form so I know I have a handle on the C_app.
PROBLEM: How do I isolate the data entry form to send value of the first name ("John") to the First_Name text box on the the data entry form?
The Logon child form was easy b/c the child form name was "logon". I can see the text of the data entry child ("Enter user info") but not its name.

thanks in advance

What I have tried:

Looped through all child forms and parent form attempting to get handle on data entry form
Updated 2-Nov-22 6:45am
Dave Kreskowiak 2-Nov-22 12:41pm    
If you're thinking of using SendKeys, you're in for a world of pain. SendKeys is not reliable at all because it just stuffs the keyboard with keystrokes. You have no control over which all gets the keystrokes. You are entirely reliant on the user not touching the mouse of keyboard while you're using SendKeys. If the users clicks in some other window, your keys will go to that window, not the one you think you're sending them to.

It is a bad idea to automate another app.
RickZeeland 3-Nov-22 2:08am    
I agree with Dave, avoid using SendKeys, even with only one other application active it won't work when this is placed on a second monitor.

1 solution

If this is an existing client app, then why go all around the houses to automate it? Instead, modify the app to automate itself. There is no need for input forms if you load the data into the appropriate classes directly and then process it using the app code.

That way, you get a cleaner, quicker solution, and one that is more robust as well - because it isn't dependant on the design / layout of forms within the app which could be changed or removed in future.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900