Page 1 of 1
How to add pause between two script lines
Posted: 27 Mar 2012 23:33
by paul0
I want to add a pause between two script lines, ie., the second line will not start until the pause is time out.
Code: Select all
"command"
run "a program";
(pause 3);
run "another program";
Please advise how to add a pause, e.g.3 seconds, explicitly.
Re: How to add pause between two script lines
Posted: 28 Mar 2012 00:00
by eil
wait 3000;
Re: How to add pause between two script lines
Posted: 28 Mar 2012 00:15
by paul0
Thanks a lot. It works perfectly.
Re: How to add pause between two script lines
Posted: 28 Mar 2012 04:04
by serendipity
paul0 wrote:Please advise how to add a pause, e.g.3 seconds, explicitly.
I know you said you wanted to wait 3 second explicitly.
But if 3 second thing is to prevent the second program from starting before first one ends then more advisable would be to use wait parameter (1) which the run command already has. Second run will start ONLY after first run is completed. So modifying your script:
Code: Select all
"command"
run "a program", ,1;
run "another program", ,1;
run "yet another program", ,1;
Re: How to add pause between two script lines
Posted: 28 Mar 2012 06:34
by Twisten
Or wait until Don will fix/enhance the run command (if thats the reason you'd prefer a timer).
Its been a topic of discussion before and one of the requests was that it won't block (or only optionally block) the XYplorer GUI just because its waiting for a shell command to finish.
It should be the script writer responsibility to make sure his script function won't be impaired by the user "wandering" into other places while the script is running.
Re: How to add pause between two script lines
Posted: 28 Mar 2012 07:20
by highend
Or wait until Don will fix/enhance the run command
Do you have any information that this will (ever) happen?
The discussion about that is rather old (in terms of releasing new betas every few days).
I'm just rewriting my little CheckProcess autoit script to work around the limitations of the
inbuild run command

Re: How to add pause between two script lines
Posted: 28 Mar 2012 07:44
by Marco
If I remember correctly, wait is an unofficial command, so be careful!
(Don, read behind the lines...

...sendkey also...

)
Re: How to add pause between two script lines
Posted: 28 Mar 2012 07:53
by Filehero
Marco wrote:If I remember correctly, wait is an unofficial command, so be careful!
Yep, it's not listed in the Scripting Commands Reference which I consider a complete list of all official (supported) commands.
Cheers,
Filehero
Re: How to add pause between two script lines
Posted: 28 Mar 2012 19:21
by paul0
serendipity wrote:
Code: Select all
"command"
run "a program", ,1;
run "another program", ,1;
run "yet another program", ,1;
Thanks, serendipity. This parameter is very useful.
I also agree with Twisten's comment.
Twisten wrote:Or wait until Don will fix/enhance the run command (if thats the reason you'd prefer a timer).
Its been a topic of discussion before and one of the requests was that it won't block (or only optionally block) the XYplorer GUI just because its waiting for a shell command to finish.
At the same time, we really don't know if the program has finished. For example, I run a DOS batch file A.bat, and A.bat calls B.bat. A.bat might complete before B.bat completes.
Re: How to add pause between two script lines
Posted: 28 Mar 2012 20:08
by highend
Atm you need some kind of an external application, that provides feedback, if something has really finished (by watching it's process).
Not hard to do with e.g. autoit or autohotkey. Ofc these scripts should be compiled and they stay in the taskmanager as long as the process is still running. They are providing the necessary feedback to XYplorer's scripts. I posted a simple approach a while back:
http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=7490
It could be done with temp files as well (the clipboard is a bit unpractical if you need to enter .zip / .rar passwords) *g*
Re: How to add pause between two script lines
Posted: 28 Mar 2012 23:15
by paul0
highend wrote:Atm you need some kind of an external application, that provides feedback, if something has really finished (by watching it's process).
Not hard to do with e.g. autoit or autohotkey. ...
Thanks, highend. I tried autoit before and it worked quite well.
Thanks all for your helpful comments.

Re: How to add pause between two script lines
Posted: 30 Mar 2024 22:18
by urka
Is there a way to make it wait until the previous line is done? Other than just increasing the wait time?
For example:
copyto "<curpath>", "D:\bla\bla";
wait 750;
renameitem ("bla2", "bla", 4);
Sometimes it works, other times it gives an error (the bla folder doesn't exist), because the folder didn't copy yet.
Re: How to add pause between two script lines
Posted: 30 Mar 2024 22:29
by highend
Is there a way to make it wait until the previous line is done?