mrw01.gms : Test MessageReceiverWindow.exe

Description


Small Model of Type : GAMS


Category : GAMS Test library


Main file : mrw01.gms

$title Test MessageReceiverWindow.exe (mrw01,SEQ=610)

$if %system.filesys% == UNIX $abort.noError WinMsg works on Windows only

$if not set title $set title Form1
Execute.Async "MessageReceiverWindow.exe %title%";
scalar s, waitTime /0/, maxTime /120/;
file f;

*wait till the window is ready to receive messages
repeat
  put_utility f 'WinMsg' / '%title%' / '@SaveAs msg_ready.txt';
  s = sleep(2);
  waitTime = waitTime + 2;
  execute 'test -e msg_ready.txt';
until errorlevel = 0 or waitTime > maxTime;

execute 'del msg_ready.txt';
display waitTime;

put_utility f 'WinMsg' / '%title%' / 'This is some Windows Message from GAMS';
s = sleep(1);
put_utility f 'WinMsg' / '%title%' / 'Another Windows Message from GAMS';
s = sleep(1);

put_utility f 'WinMsg' / '%title%' / '@CopyToClipboard';
put_utility f 'WinMsg' / '%title%' / '@SaveAs test.txt';
put_utility f 'WinMsg' / '%title%' / '@Terminate';
s = sleep(1);

$onEcho > want.txt
??:??:?? ??: This is some Windows Message from GAMS
??:??:?? ??: Another Windows Message from GAMS
$offEcho

execute 'cut -c12- want.txt > want.red';
execute 'cut -c12- test.txt > test.red';

execute '=diff -bw test.red want.red';
abort$errorlevel 'test and want differ';