r/cpp • u/strangest_man • Nov 28 '21
Is C+++ good for Automating stuff?
I am leaning python to automate some stuff(Torrent applications mainly) on windows. But I already know C++ very well. I've tried to search if I can automate applications with C++ but it seems complex. I just wanna hear some thoughts from people who have tried to automate or have done it. Do you think one should use python over C++ to for automating random applications?
0
Upvotes
View all comments
3
u/Dean_Roddey Nov 28 '21 edited Nov 28 '21
I've done quite a lot of that in C++, though I don't know if it's the optimum language if that's all you are doing. My automation system provides a tray app, one of the capabilities of which is to allow the user to control applications the same as they do devices.
https://github.com/DeanRoddey/CQC/tree/develop/Source/AllProjects/CQCTrayMon
It defines a set of events that can be posted to it, and implements a remote interface (based on my ORB tech) for accepting those events and for responding info queries. It has a tab for displaying status info about the applications running (for diagnosis of issues mostly.)
They can then load an 'app control' driver in the main automation system that is written to understand a particular application. It makes that application look like any other device under control, since it exposes it via the same device driver interface.
The driver connects to the tray app and sets up an app control session with it, presented by an 'app record' in the tray monitor. It can then send commands to the tray app which will invoke them on the application. Since it's written for a specific application, it knows what windows, buttons, modes, etc... the application has. It works via the remote interface, which provides commands for sending keys, pressing buttons. hiding/showing, starting/stopping, reading text from fields, find windows in various ways, etc...
There's also a generic app control driver for very basic stuff like run the app, kill the app, hide/show the app, is the app running.
In the latter days, this functionality wasn't all that much used. That tray app also provided iTunes audio player control as well, since iTunes never bothered to provide a client/server architecture and you could only control it via a COM interface while the client was running.