Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

How to get AHK to wait a specified amount of time?


  • Please log in to reply
7 replies to this topic
begtognen
  • Members
  • 8 posts
  • Last active: Oct 24 2010 10:11 AM
  • Joined: 23 Dec 2008
I'd like to know how to get AHK to wait a specific amount of time before moving to the next step in the script.

The problem is this: the window I want to perform the keystrokes on is a Properties window. The specific window name will change daily, so using a WinWait command won't work.

I'd like to do this:

{APPSKEY}r (wait 2 seconds) {CTRLDOWN}{TAB}{TAB}{CTRLUP}

If I try without the wait, AHK attemps to send the second command too fast and it doesn't work.

I did see a reference somewhere to a "sleep" command - maybe that would work...?

Thanks much for any suggestions you might have.

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Refer AHK Doc for SetKeyDelay command

sammy2
  • Guests
  • Last active:
  • Joined: --
Using SetKeyDelay as SKAN suggested will work, but the side effect is that the value you set for SetKeyDelay will apply to all keys sent (until you reset it). I think this is probably what you want.
send {APPSKEY}r 
sleep, 2000 ;(wait 2 seconds) 
send {CTRLDOWN}{TAB}{TAB}{CTRLUP}


Razlin
  • Members
  • 454 posts
  • Last active: Feb 05 2014 06:21 PM
  • Joined: 05 Nov 2007
lookup sleep

send, asdf
sleep
send, asdf

-=Raz=-

jaco0646
  • Moderators
  • 3165 posts
  • Last active: Apr 01 2014 01:46 AM
  • Joined: 07 Oct 2006

The specific window name will change daily

...but its ahk_class probably won't. I'm guessing the class (which you could find out with Window Spy) is #32770.
WinWait, ahk_class #32770


begtognen
  • Members
  • 8 posts
  • Last active: Oct 24 2010 10:11 AM
  • Joined: 23 Dec 2008
Thanks so much for all the suggestions.

I think I must be doing something wrong, because I couldn't get Sleep or WinWait to work.

Window Spy does confirm that the class is #32770, but this script:

send {APPSKEY}r
WinWait, ahk_class #32770
send {CTRLDOWN}{TAB}{TAB}{CTRLUP}

Doesn't work. It goes to the Property window, then never control-tabs. Trying sleep:

send {APPSKEY}r
sleep, 2000
send {CTRLDOWN}{TAB}{TAB}{CTRLUP}

has the same result.

Am I missing something...?

GoJin
  • Members
  • 1 posts
  • Last active: May 13 2015 05:11 PM
  • Joined: 13 May 2015

Thanks so much for all the suggestions.

I think I must be doing something wrong, because I couldn't get Sleep or WinWait to work.

Window Spy does confirm that the class is #32770, but this script:
 

send {APPSKEY}r
WinWait, ahk_class #32770
send {CTRLDOWN}{TAB}{TAB}{CTRLUP}
Doesn't work. It goes to the Property window, then never control-tabs. Trying sleep:

send {APPSKEY}r
sleep, 2000
send {CTRLDOWN}{TAB}{TAB}{CTRLUP}
has the same result.

Am I missing something...?

 

.everything is good except the last line...

it should have been:

 

Send, {CTRL DOWN}{TAB 2}{CTRL UP}

 

you combined ctrl down & up

there must be a blank space between CTRL and DOWN/UP



steo
  • Members
  • 1 posts
  • Last active: Dec 28 2015 07:13 PM
  • Joined: 28 Dec 2015

need help..

 

may be very simple for you people.

 

need to divide by /.9 and paste the window..

 

basicaly how can i compute.. the amout will be there in the softerware