Page 1 of 1

Presiings a sequence of two keys at different time

Posted: 14 Jun 2019, 09:12
by azkolit
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!

Re: Presiings a sequence of two keys at different time

Posted: 15 Jun 2019, 11:37
by azkolit
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.

Re: Presiings a sequence of two keys at different time

Posted: 15 Jun 2019, 12:09
by Rohwedder
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