Problem with timing

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Problem with timing

Post by Jerry Thomas » Fri Jul 19, 2013 9:18 pm

I am having a timing problem with a DOS command

If I step through this code, it works fine.
If I run it, I get bad results.
If I run it with the Wait uncommented, I get the right results (unless the file list is going to be really large, in which case I have bad results but don't know it.)

MS doesn't have a WaitUntilPreviousCommandIsFinished
How can I tell how much delay I need here?
I don't want to put Wait>10 just to be safe.

Code: Select all

Let>FileListFile=%DESKTOP_DIR%\FileList.txt
DeleteFile>FileListFile
Let>TargetDir=c:\Users

Run>cmd /c Dir %TargetDir%\*.* /s /b >%FileListFile%
//Wait>2

ReadFile>FileListFile,FileList
Length>FileList,Lngth
MDL>Lngth
Thanks,
Jerry

[email protected]

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Jul 19, 2013 9:34 pm

As I said in the other "Dir" thread. You probably need to use RP_WAIT. Setting RP_WAIT to one causes the Run> function to halt the script until the function has completed. It is the way to WaitUntilPreviousCommandIsFinished.

Let>FileListFile=%DESKTOP_DIR%\FileList.txt
DeleteFile>FileListFile
Let>TargetDir=c:\Users

Let>RP_WAIT=1
Run>cmd /c Dir %TargetDir%\*.* /s /b >%FileListFile%
//Wait>2

ReadFile>FileListFile,FileList
Length>FileList,Lngth
MDL>Lngth

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Fri Jul 19, 2013 9:37 pm

I got so excited that it was working, that I totally missed the RP_Wait.

Thanks again!
Thanks,
Jerry

[email protected]

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts