Simulate command window keystrokes from script/m-file
Mostrar comentarios más antiguos
I have an application, that runs through the system's cmd prompt. It takes an input file, along with a series of predictable/fixed keystrokes to process the input, and generate the output. All 'quotes' are supposed to be keystrokes. Manually, this is how it goes:
>open cmd prompt in current folder
>'app input.in'
>'set gust'
>'set oper'
>'x'
>'r'
i now wait 5-10 minutes for the program to finish
>'write output.out'
I'd like to implement the entire process, including typing the fixed keystrokes in matlab, but all answers so far point to using external tools like autohotkey.... I tried using the dos command as follows...
dos(['app input.in']) dos(['set gust']) dos(['set oper']) dos(['x']) dos(['r']) pause(600) dos(['write output.out'])
but that doesn't work, as the program pauses after the first command , and I have no way to enter the keystrokes from my .m file into the command window, without manually typing them in.
Respuestas (1)
Jeff Miller
el 25 de Mayo de 2018
If the app will read from redirected input, you might be able to use something like this:
'app input.in < keys.txt'
keys.txt is a plain text file with the input you would type, e.g.:
set gust
set oper
x
r
write output.out
1 comentario
Ali
el 27 de Mayo de 2018
Categorías
Más información sobre App Building en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!