How to add pause between two script lines

Discuss and share scripts and script files...
Post Reply
paul0
Posts: 137
Joined: 23 Oct 2009 19:26

How to add pause between two script lines

Post 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.

eil
Posts: 1623
Joined: 13 Jan 2011 19:44

Re: How to add pause between two script lines

Post by eil »

wait 3000;
Win 7 SP1 x64 100% 1366x768

paul0
Posts: 137
Joined: 23 Oct 2009 19:26

Re: How to add pause between two script lines

Post by paul0 »

Thanks a lot. It works perfectly.

serendipity
Posts: 3358
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: How to add pause between two script lines

Post 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;

Twisten
Posts: 204
Joined: 27 Apr 2008 10:30

Re: How to add pause between two script lines

Post 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.

highend
Posts: 13338
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to add pause between two script lines

Post 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 ;)
One of my scripts helped you out? Please donate via Paypal

Marco
Posts: 2347
Joined: 27 Jun 2011 15:20

Re: How to add pause between two script lines

Post by Marco »

If I remember correctly, wait is an unofficial command, so be careful!
(Don, read behind the lines... :whistle: ...sendkey also... :whistle: )
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

Filehero
Posts: 2646
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: How to add pause between two script lines

Post 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

paul0
Posts: 137
Joined: 23 Oct 2009 19:26

Re: How to add pause between two script lines

Post 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.

highend
Posts: 13338
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to add pause between two script lines

Post 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*
One of my scripts helped you out? Please donate via Paypal

paul0
Posts: 137
Joined: 23 Oct 2009 19:26

Re: How to add pause between two script lines

Post 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. :)

urka
Posts: 1
Joined: 14 May 2023 04:57

Re: How to add pause between two script lines

Post 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.
Last edited by urka on 30 Mar 2024 22:19, edited 1 time in total.

highend
Posts: 13338
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to add pause between two script lines

Post by highend »

Is there a way to make it wait until the previous line is done?

Code: Select all

setting "BackgroundFileOps", 0;
One of my scripts helped you out? Please donate via Paypal

Post Reply