You can use Windows Script Host (WSH) to replace the RUN command. It has a parameter to run synchronously so VFP will wait for termination before resuming.
#define SW_SHOW_NORMAL 1
#define SW_SHOW_MINIMIZED 2
#define SW_SHOW_MAXIMIZED 3
#define SYNCH .T.
#define ASYNCH .F.
oShell = createobject("WScript.Shell")
oShell.Run("acrodist.exe &sdewse2(strtofile)",SW_SHOW_NORMAL,SYNCH)
>I need someone to help me with this. Several people have tried with different approches but none have worked so far.
>
>I have a folder that is populated with .ps files from another app that many users are printing from. My fist step with my watch app is to create a new folder with the base name of each set of files with the same base name then create a STRTOFILE file and put into the new directory also. This I have done with no problem. Note this is done to batch for processing.
>
>The next step is to Run /N2 acrodist.exe &sdewse2(strtofile). This is where my problem lies. I need this to run unattended so I can't phyisically exit Distiller with each batch finishing. So I need a way to halt the execution of the VFP code until the batch is finished. Then run the next one.
>
>I have tried to use FOPEN() and FClose() but then I get an error that Distiller can't open the file randomly.
>
>I need a way to tell that distiller is executing a job and let me know when it is finished.