is it possible to open an exe and then fill in some textboxes?
i want to open a program, like anydvd, and have it automatically rip a dvd. then, when it's finished, i want to open dvdshrink, fill in the location of the new file, then have it rip. how do i do this with a c# program? yes i know anydvd can automatically rip a file, but i want to automate the process, so i can just insert a dvd and then convert it into an mpg. thanks

1 answers
As you probably know, it's easy to launch another exe from a C# program by using the System.Diagnostics.Process class. For example:
Process p = Process.Start("someprog.exe", "args");p.WaitForExit();
The first thing to look at is whether you can do what you want by simply passing command line arguments (using "args" above).
If you can't but the textbox you need to fill in automatically gets focus when the program starts, then you can use SendKeys.Send() or SendWait() to send the appropriate keystrokes to that textbox. Before doing this, it's a good idea to call p.WaitForInputIdle() to give the application's main window time to initialize itself.
If the textbox doesn't get focus automatically but you can move focus to it with a keyboard shortcut, then you can use SendKeys to send the shortcut and then send the file location.
There are various API functions that can be used as well but the above is probably all you'll need for this particular exercise.
answered 2 years ago by:
17279
237
thanks vulpes, i'll try that