AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

RunWait - SecondsToWait

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
adamrgolf



Joined: 28 Dec 2006
Posts: 362

PostPosted: Thu Jun 26, 2008 6:50 am    Post subject: RunWait - SecondsToWait Reply with quote

Is is possible to include a "SecondsToWait" parameter for RunWait much like WinWait has?
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 5893

PostPosted: Thu Jun 26, 2008 7:16 am    Post subject: Reply with quote

Would not be hard to implement, I guess..
but how useful would it be ?

Smile
_________________
SKAN - Suresh Kumar A N
Back to top
View user's profile Send private message
adamrgolf



Joined: 28 Dec 2006
Posts: 362

PostPosted: Thu Jun 26, 2008 7:55 am    Post subject: Reply with quote

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 Smile

thanks for listening!
Back to top
View user's profile Send private message
Krogdor



Joined: 18 Apr 2008
Posts: 935
Location: The Interwebs

PostPosted: Thu Jun 26, 2008 8:32 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
adamrgolf



Joined: 28 Dec 2006
Posts: 362

PostPosted: Thu Jun 26, 2008 8:53 am    Post subject: Reply with quote

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. Smile
Back to top
View user's profile Send private message
Krogdor



Joined: 18 Apr 2008
Posts: 935
Location: The Interwebs

PostPosted: Thu Jun 26, 2008 9:02 am    Post subject: Reply with quote

Yeah, it makes sense since all of the other Wait commands have it. Shouldn't be hard to implement (?) either.
Back to top
View user's profile Send private message AIM Address
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Thu Jun 26, 2008 5:11 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
adamrgolf



Joined: 28 Dec 2006
Posts: 362

PostPosted: Thu Jun 26, 2008 5:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Thu Jun 26, 2008 5:31 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Lexikos



Joined: 17 Oct 2006
Posts: 2558
Location: Australia, Qld

PostPosted: Sun Jun 29, 2008 7:28 am    Post subject: Reply with quote

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
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2405

PostPosted: Sun Jun 29, 2008 5:36 pm    Post subject: Reply with quote

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 Smile . 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
View user's profile Send private message Visit poster's website
adamrgolf



Joined: 28 Dec 2006
Posts: 362

PostPosted: Mon Jun 30, 2008 2:02 am    Post subject: Reply with quote

very nicely done, this will work for now, but i wonder what Chris thinks about including a seconds2wait in RunWait
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group