Presiings a sequence of two keys at different time

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
azkolit
Posts: 2
Joined: 14 Jun 2019, 09:07

Presiings a sequence of two keys at different time

14 Jun 2019, 09:12

Hello,

I am trying to make a script to press a sequence of two keys as it follows:

---
Press "F1"
wait 10 seconds
Press "Space"
Wait 30 seconds and then starts over
---
I started with something like that, but nothing happens.

Code: Select all


Settimer, Routine, 30000

Routine:
Send, {F1}
return

Settimer, Routine, 10000

Send, {Space}
return
Could somebody please help me? Thank you very much!
Last edited by azkolit on 15 Jun 2019, 12:01, edited 1 time in total.
azkolit
Posts: 2
Joined: 14 Jun 2019, 09:07

Re: Presiings a sequence of two keys at different time

15 Jun 2019, 11:37

I manage to make a script to press F1 and SPACE in an infinite loop:

Code: Select all

~F7::     
  loopActive:=!loopActive 
  while loopActive        
  {                                                                                                                
     Send {F1}{SPACE} 
  }
return
However, I am unable to set a time between repeating the sequence. The purpose is to wait 20seconds between a new run. I tried these two ones, but none is working. The script runs without any interruption in the loop.

Code: Select all

~F7::     
  loopActive:=!loopActive 
  while loopActive        
  {                                                                                                                
     Send {F1}{SPACE} 
  Sleep, 20000 
  }
and

Code: Select all

~F7::     
  loopActive:=!loopActive 
  while loopActive        
  {                                                                                                                
     Send {F1}{SPACE} 
     SetKeyDelay, 20000
  }
Can anyone help me adapt this, so I can have a 20 seconds pause between repeating the sequence? Thank you.
Rohwedder
Posts: 7625
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Presiings a sequence of two keys at different time

15 Jun 2019, 12:09

Hallo,
as an answer to your first post.
Try:

Code: Select all

TF1:
Send, {F1} ;Press "F1"
SetTimer, TSpace, -10000 ;Wait 10 seconds
Return
TSpace:
Send, {Space} ;Press "Space"
SetTimer, TF1, -30000 ;Wait 30 seconds
Return ;and then starts over

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: CuriousDad, rc76 and 240 guests