How to open/run/control an .exe application using Matlab on windows OS?
22 views (last 30 days)
Show older comments
Hi,
I want to run/ control an external *.exe application using Matlab.
I need to pass some commands on open .exe or control some button clicks on .exe
I used system('*.exe') to open the application.
But, I want to then give commands from Matlab to the application like:
Prompt on the application: Enter Y or N:
In this case, I want to use Matlab and enter Y or N.
Another requirement:
Prompt on application: select a file and click OK?
I want to supply filename like file.txt and click OK using Matlab.
I heard actxcontrol or something like this is used for this but not able to find examples of this specfic needs.
Any help,
Thanks,
Gopi
0 Comments
Answers (1)
Guillaume
on 22 Jun 2018
actxcontrol is used to embed com (activex) controls into a matlab GUI. These would not come as .exe but as .dll or .ocx.
actxserver to talk to com server. Possibly, your application does have a com interface which you could use to control it but usually such com interface is not designed to interact with the GUI. If the application does not have a com interface, actxserver can't be used.
Your only option left would then be to use the UI automation framework that comes with .Net (which you can call directly from matlab). That will only work if the application uses standard windows control and follows windows design guidelines. Even then, it's going to be a lot of work and requires a fair bit of reverse engineering.
If the application you want to automate is publicly available give us a link so we can see what options are available.
2 Comments
Guillaume
on 25 Jun 2018
The page you've linked sort of explain how to talk to the software from matlab. The details are in http://metz-roc.uchicago.edu/MetzROC/software/how-to-call-metz-roc-functions.
This completely bypass the GUI. You would be using loadlibrary to load their dll then use calllib to call whichever function you need after having prepared your inputs/outputs adequately. Exact details to work out yourself from the above documentation. They did have available on demand their own wrapper function to make that easier but as the software is no longer supported, you're out of luck on that front.
See Also
Categories
Find more on Use COM Objects in MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!