Running an external application in a loop
Posted on 2003-03-14
I need to be able to run an external application over and over again, each time with the input file updated. I have attempted this in a loop as follows.
Open NewFilePath For Input As #1
Do Until EOF(1)
Open "c:\Program Files\Paradis\Input.dat" For Output As #2
Input #1, R_ROAD_X1, R_ROAD_Y1, INFO
Input #1, R_ROAD_X2, R_ROAD_Y2, INFO
Write #2, R_ROAD_X1
Write #2, R_ROAD_Y1
Write #2, R_ROAD_X2
Write #2, R_ROAD_Y2
ChDir "c:\program files\paradis"
Shell "c:\program files\paradis\paradis_calc.exe"
This has the problem that when the program loops and it gets back to the execution of the file the input file is still open and being used by the external application.
Is there anyway of waiting until the external application has finished and then looping.
Many thanks for anyones help.