Click here to Skip to main content
15,890,845 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I made an .exe in C# which can run an application, but I want to make it make the application that it ran do things. For example: the exe opens Microsoft Word, makes it open a document and closes it.

What I have tried:

I haven't tried anything yet, because I have no idea where to start.
Posted
Updated 12-Apr-17 3:16am
Comments
PIEBALDconsult 12-Apr-17 9:31am    
You can't unless that application allows that sort of thing -- and most GUI applications do not.
For many command-line type apps that accept textual commands, you can write an application that allows you to write scripts.

http://www.codeproject.com/Messages/3409061/How-do-I-drive-a-command-line-utility-beyond-execu.aspx
F-ES Sitecore 12-Apr-17 12:18pm    
Google "automate Word c#" and you'll find lots of examples.

1 solution

The simplest solution is to use command line arguments when starting the other application. See Command-Line Arguments (C# Programming Guide) | Microsoft Docs[^].

For more complex situtions you can use IPC (Inter Process Communication). Because there are many different IPC methods, I can't suggest one without knowing what you want to do (when and how often commands should be passed and the amount of data that should be passed).

There are some articles here at CodeProject about IPC: Search: "c# ipc"[^]
 
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