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.

回答 (1 件)

Jeff Miller
Jeff Miller 2018 年 5 月 25 日

0 投票

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 件のコメント

Ali
Ali 2018 年 5 月 27 日
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.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeApp Building についてさらに検索

質問済み:

Ali
2018 年 5 月 24 日

コメント済み:

Ali
2018 年 5 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by