How to make macro waiting beteween commands ?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Okapi
Junior Coder
Posts: 28
Joined: Wed Dec 29, 2010 1:22 am

How to make macro waiting beteween commands ?

Post by Okapi » Thu May 26, 2011 1:39 pm

Hi all,
In this code, a hiding tool is used to hide console window that searches files in C: then D: then E:

Code: Select all

//command 1
Run>hider.exe "cmd /c dir c:*.* /s /b >> result.txt"
//command 2
Run>hider.exe "cmd /c dir d:*.* /s /b >> result.txt"
//command 3
Run>hider.exe "cmd /c dir e:*.* /s /b >> result.txt"
Using the hider poses a problem, because the macro jumps immediately from command 1 to the following command, without waiting command 1 to finishes the search that takes some seconds. So commands 2 and 3 are not executed because result.txt is still in use by command 1.

Anyone has an idea to make this macro to not execute a command till the command above it has finished. I don't want to put just wait>x because x can vary according to many factors. Thanks

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Thu May 26, 2011 2:26 pm

make this macro to not execute a command till the command above it has finished.
From the Help File --------

Code: Select all

By setting the RP_WAIT variable to 1 prior to issuing the Run Program
command the script will wait until the program launched by Run Program
has terminated before continuing.  The default value of RP_WAIT is 0.

Set RP_WAIT to 2 if you want the script to wait until it thinks the program
is idle and ready for input.  This only works for GUI applications and may
not be appropriate for all applications.  Some applications may appear
ready for input before they really are.  See WaitWindowOpen and
WaitReady for other ways to wait until an application is ready.

By setting the RP_WINDOWMODE variable programs can be executed
minimized, maximised, hidden or normal.  RP_WINDOWMODE can be one
of the following :


0: Hidden
1: Normal (default)
2: Minimized
3: Maximized


If you set RP_WINDOWMODE it is used by all subsequent Run Program
commands, so remember to set it back if you don't want the same window
mode to be used each time.
No need to use the hider tool either...... just make the window "hidden" following above advice.

Okapi
Junior Coder
Posts: 28
Joined: Wed Dec 29, 2010 1:22 am

Post by Okapi » Thu May 26, 2011 3:32 pm

RP_WAIT can't do it's job with the hider because it's a launcher that terminates in less then a second. Okay RP_WINDOWMODE=1 is better, with RP_WAIT=0 it works perfect, thanks.

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