With either version I would expect WriteLn to fail if the other process has the file locked.
In any case it would be sensible to add a small delay inside the loop to prevent the loop from locking up the CPU. You also need a return var for WriteLn. I would also provide a proper path otherwise it will write to/read from CWD which may be different for each EXE.
Code: Select all
Label>start
WriteLn>%SCRIPT_DIR%\test.txt,res,
Wait>0.2
ReadFile>%SCRIPT_DIR%\test.txt,test
goto>start
You could also add some "semaphore" type communication. Have the script write a flag to an INI file when it does the WriteLn, and reset the flag afterwards. Have the script wait for the flag to be reset before continuing. That would prevent a collision. Something like:
Code: Select all
Label>start
Label>WaitWhileWriting
Wait>0.2
ReadIniFile>%SCRIPT_DIR%\control.ini,SETTINGS,writing,isWriting
If>isWriting=1
Goto>WaitWhileWriting
Else
EditIniFile>%SCRIPT_DIR%\control.ini,SETTINGS,writing,1
Endif
WriteLn>%SCRIPT_DIR%\test.txt,res,
EditIniFile>%SCRIPT_DIR%\control.ini,SETTINGS,writing,0
Wait>0.5
ReadFile>%SCRIPT_DIR%\test.txt,test
goto>start