| View previous topic :: View next topic |
| Author |
Message |
adamrgolf
Joined: 28 Dec 2006 Posts: 362
|
Posted: Thu Jun 26, 2008 6:50 am Post subject: RunWait - SecondsToWait |
|
|
| Is is possible to include a "SecondsToWait" parameter for RunWait much like WinWait has? |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5893
|
Posted: Thu Jun 26, 2008 7:16 am Post subject: |
|
|
Would not be hard to implement, I guess..
but how useful would it be ?
 _________________ SKAN - Suresh Kumar A N |
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 362
|
Posted: Thu Jun 26, 2008 7:55 am Post subject: |
|
|
| SKAN wrote: | | how useful would it be ? |
well, perhaps if you run an app and it locks up or something goofy.
this is mainly the reason I ask: i had a script that would hang on runwait for an exe that did in fact start up, but the script would still wait for it... no matter what I tried it would hang there.
in my case run will suffice, but i liked that the script would not continue until that exe was ready. I know it only takes a second or two to start, so a sleep will work for now, but i just thought i'd throw this idea out there
thanks for listening! |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 935 Location: The Interwebs
|
Posted: Thu Jun 26, 2008 8:32 am Post subject: |
|
|
You could make a workaround involving a timer...
| Code: | SetTimer, RunWaitTimeout, -5000 ;five seconds
RunWait, blahblah
RunWaitTimeout:
If (AlreadyCalled)
Return
AlreadyCalled:=True
;do stuff
AlreadyCalled:=False ;in case this subroutine will be called again
Return |
|
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 362
|
Posted: Thu Jun 26, 2008 8:53 am Post subject: |
|
|
| Krogdor wrote: | | You could make a workaround involving a timer...[/code] |
I realize this Krogdor, you could also do the same thing with a WinWait command if it didn't have a 'secondstowait' parameter. Having this sort of parameter for any "Wait" command just makes sense.  |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 935 Location: The Interwebs
|
Posted: Thu Jun 26, 2008 9:02 am Post subject: |
|
|
| Yeah, it makes sense since all of the other Wait commands have it. Shouldn't be hard to implement (?) either. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Thu Jun 26, 2008 5:11 pm Post subject: |
|
|
| adamrgolf wrote: |
this is mainly the reason I ask: i had a script that would hang on runwait for an exe that did in fact start up, but the script would still wait for it... no matter what I tried it would hang there.
|
Are you saying that the exe successfully started and finished, but the script did not continue, or are you saying that the exe successfully started but had not yet finished, but the script did not continue? _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 362
|
Posted: Thu Jun 26, 2008 5:26 pm Post subject: |
|
|
| engunneer wrote: | | adamrgolf wrote: |
this is mainly the reason I ask: i had a script that would hang on runwait for an exe that did in fact start up, but the script would still wait for it... no matter what I tried it would hang there.
|
Are you saying that the exe successfully started and finished, but the script did not continue, or are you saying that the exe successfully started but had not yet finished, but the script did not continue? |
Actually, I just realized I read the description wrong for RunWait, where it says: "Unlike Run, RunWait will wait until Target is closed or exits," I thought it read "is closed or exists"... now it makes a lot more sense...
However, Wouldn't having a seconds to wait before continuing still be a good idea in case Target does not work properly? |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Thu Jun 26, 2008 5:31 pm Post subject: |
|
|
sure, it's still a good feature request, and there is a workaround in the meantime, but i just wanted to be sure I knew exactly what you were asking. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2558 Location: Australia, Qld
|
Posted: Sun Jun 29, 2008 7:28 am Post subject: |
|
|
| adamrgolf wrote: | | I realize this Krogdor, you could also do the same thing with a WinWait command if it didn't have a 'secondstowait' parameter. | To emulate the proposed functionality more accurately, you could use Process, WaitClose, PID-or-Name, Seconds-to-Wait... |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2405
|
Posted: Sun Jun 29, 2008 5:36 pm Post subject: |
|
|
| Lexikos wrote: | | adamrgolf wrote: | | I realize this Krogdor, you could also do the same thing with a WinWait command if it didn't have a 'secondstowait' parameter. | To emulate the proposed functionality more accurately, you could use Process, WaitClose, PID-or-Name, Seconds-to-Wait... | Good idea . Something like this maybe... | Code: | ; RunWaitTimeout(Target[, SecondsToWait, WorkingDir , Max|Min|Hide])
RunWaitTimeout(Target, SecondsToWait="", WorkingDir="", MaxMinHide="") {
Run, %Target%, %WorkingDir%, %MaxMinHide%|UseErrorLevel, OutputVarPID
If (ErrorLevel)
Return ErrorLevel
Process, WaitClose, %OutputVarPID%, %SecondsToWait%
If (ErrorLevel) {
Process, CLose, %OutputVarPID%
Return !(ErrorLevel)
}
Return ErrorLevel
}
|
|
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 362
|
Posted: Mon Jun 30, 2008 2:02 am Post subject: |
|
|
| very nicely done, this will work for now, but i wonder what Chris thinks about including a seconds2wait in RunWait |
|
| Back to top |
|
 |
|