Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Wait 5 secs in a loop


5 replies to this topic

guyjoules

guyjoules
  • Full Members
  • 18 posts

Posted 17 January 2008 - 22:16

Hi.

I want to wait n seconds while running a loop.

Something like this -

startTime = Currenttime(); // this will set x to the current time

repeat

do some work here.....

diffTime = Currenttime() - StartTime;
until (diffTime = 5)

What is the easiest way to do it?

thanks

daengh

daengh
  • Full Members
  • 8 posts

Posted 17 January 2008 - 22:23

Look at the 'Delay' function.


guyjoules

guyjoules
  • Full Members
  • 18 posts

Posted 17 January 2008 - 22:49

Thank you, but Delay(n) returns after n secs passes and I need to check something during that time.
Actually, I'm waiting for a custom process to finish, but if it hang, I want to abort after 5 or 10 secs. Delay() won't help me in this case.


Thanks

daengh

daengh
  • Full Members
  • 8 posts

Posted 22 January 2008 - 22:25

If you use LaunchApp() to start your process, Delay() to wait for completion, then check the LaunchApp return, does that not do what you want?

ie (assuming correct declarations)

returnValue = LaunchApp (myApp, myArgs );
Delay(5);
if returnValue < 0 then
// error handling/messaging here
endif;

Check the LaunchApp or LaunchAppAndWait documentation.

Edited by daengh, 22 January 2008 - 22:26.


guyjoules

guyjoules
  • Full Members
  • 18 posts

Posted 23 January 2008 - 08:23

Thanks.

This could have been the solution but I can't tell if 5 secs is enough. It could be between 5-60 secs and I don't want the user to wait for nothing, because it can return in 2 secs as well.

Also, I would like to do something while I'm waiting...

Thanks!

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 24 January 2008 - 11:36

You could look into the extended functionality of LaunchAppAndWait, see LAAW_PARAMETERS and LAAW_STARTUPINFO. If that doesn't do what you need call GEtSystemInfo with the TIME parameter to get the current time.