open external programs via matlab
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
AA
el 21 de En. de 2015
Comentada: Jung Sunghun
el 10 de Jul. de 2021
h = actxserver('WScript.Shell');
h.Run('notepad'); %Invokes notepad.exe
pause(3); %Waits for the application to load.
h.AppActivate('Notepad'); %Brings notepad to focus
h.SendKeys('hello world~'); %Sends keystrokes
h.SendKeys('^s'); % save file
pause(3);
h.SendKeys('test.txt~'); % save as 'test.txt' and return
h.SendKeys('%{F4}'); % close Notepad Alt+F4
The above example illustrates that you can send keystrok
The above code allows me to open an external application like notepad. However, I want to try the above code with microsoft word or adobe. How can I implement those changes?
thanks
0 comentarios
Respuesta aceptada
Más respuestas (1)
Zoltán Csáti
el 22 de En. de 2015
If you want to open an external file outside MATLAB, use the exclamation mark operator. In your case:
!notepad.exe
All you have to do is search on the internet how to open those applications from the command line.
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!