how to operate an exe from another exe in VB2013

Hello experts,
We have this program from Zebra that prints the labels just the right way.

Our App has a function but its never as accurate as the Factory software.
Problem is this Factory software needs to fill in ten fields manually and then print.

In order to save our users the time and effort of filling these fields manually we would like to créate a very small program in visual basic that will open the application, fill the fields and press PRINT button..... like a very Little robot?

Can you send us an example on how to do this ? Preferable in VB 2013 but could be in  any other language ? an example with the source would be enough.

WE have a robot already working with websites filling data and working fine.

But with a desktop App we dont know how to do it yet. Please your advice.

Regards!
RGuillermoProject ManagerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mankowitzCommented:
I would use AutoHotKey for something like this. I can't provide a complete example, but you're going to want something like this:

Lets assume that the data you want to populate are in param1, param2, param3 in your VB.NET program.

Process.Start("C:\autohotkey.exe zebra-script.ahk  """ & param1 & """, """ & param2 & """, """& param3 & """)

Now, your zebra-script.ahk would look something like this

Run, zebra-executable.exe  ; substitute name of the zebra executable
WinWaitActive, Zebra, , 2     ; substitute the name of the zebra window
Click 44, 55                               ; the location on the window where the input box is
Send %1%                                 ; the text of the first parameter
Click 88,99                                ; the second text box
Send %2%                               ; the second parameter
Click 100,200                            ; The "print" button
Send !{f4}                                ; an exit command, such as alt-F4
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jacques Bourgeois (James Burger)PresidentCommented:
I would first ask the people at Zebra if their software has been designed to be controlled through COM or .NET. If so, they should be able to provide you with the necessary documentation.

You can use the SendKeys class in the System.Windows.Forms namespace. Its Send method enables you to send keys in the system as if they were sent through the keyboard.

Be aware however that you cannot target a specific application. The keys go just as if they were typed, to the active application. This can lead to problems in some situations, specially if you send control keys. I have encountered a situation, a few years ago, where we where using it to fill out a form and then send a Ctrl-P to print the result. If a user switched to another application while we were processing the data, the Ctrl-P ended up in the other application.

User should be advised to wait until the operation is complete before switching to another application. On your side, try to build a long String (control characters and shortcuts can be embedded in the string required by SendKeys) and send it in one batch instead of calling Send multiple times as you go along.
0
frankhelkCommented:
The problem with "active application" could be mostly circumvented ...

Process.Start() returns a System.Diagnostics.Process object that contains - among numerous other informations - the MainWindowHandle of the process. If you constantly bring that up to front & focus before sending a key, almost no keystroke will get lost.
0
RGuillermoProject ManagerAuthor Commented:
Jacques Bourgeois (James Burger; I spoke to people at ZEBRA, their software cannot be integrated, the best is send data to an Access table and pull it from their App. Still making our users work with and additonal application.
Never the less it was useful talking to them because I discovered a few useful things to configurate the printer.
Thank you Jacques,

mankowitz and frankhelk, we are still testing your suggestions, thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.