>I needed to generate a dbf file within a VFP application - when the file was done I had to first run it thru (within VFP) a third party WINDOWS app for further processing and when that was ready I had to run it thru a second Windows app. The code I wrote was as follows:
>
>generate DBF ...
>RUN /N app1.exe ...
>RUN /N app2.exe ...
>
>The problem was app2 loaded right behind app1's tail and it started processing before app1 finished or even started it's job. I tried the /N3 switch and NO switch and also placing both *RUN* lines in a single DOS .bat file. Any help would be appreciated.
How about this:
App1.bat:
@ECHO OFF
APP1.EXE
DEL FILE1.DAT
App2.bat:
@ECHO OFF
APP2.EXE
DEL FILE2.DAT
Now, in Foxpro:
m.fnum = FCREATE("FILE1.DAT")
=FCLOSE(m.fNum)
RUN APP1.BAT
DO WHILE FILE("FILE1.DAT")
DOEVENTS
ENDDO
m.fNum = FCREATE("FILE2.DAT")
=FCLOSE(m.fNum)
RUN APP2.BAT
DO WHILE FILE("FILE2.DAT")
DOEVENTS
ENDDO
The idea is to create a file that will be deleted when we are ready to go to the next step. I think it's called a semaphore file. I have done little error handling (like what if our
FCREATE
failed?).
Sylvain Demers