Simulate command window keystrokes from script/m-file

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.

Antworten (1)

Jeff Miller
Jeff Miller am 25 Mai 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 Kommentar

Ali
Ali am 27 Mai 2018
Unfortunately, that will not work, as the application doesn't function that way. It's just a FEM software that accepts keystrokes as the only method of user interface.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu App Building finden Sie in Hilfe-Center und File Exchange

Gefragt:

Ali
am 24 Mai 2018

Kommentiert:

Ali
am 27 Mai 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by