Hi,
How do I send a key combination, for example, Alt+Q, at a specified time, for example, 9:45 AM, every day?
What script should I use?
Send a combination at a specified time every day
Re: Send a combination at a specified time every day
Hello,
Try
reference:
https://autohotkey.com/board/topic/1996 ... ime/page-2
HTH
Try
Code: Select all
target_time = 0945 ; 09:45 am
; Get target time in a format we can:
; - compare (with "<"), and
; - use to calculate "time delta" (with EnvSub.)
target = %A_YYYY%%A_MM%%A_DD%%target_time%00
; < comparison should be safe as long as both are in the *exact* same format.
if (target < A_Now)
{ ; time(today) has passed already, so use time(tomorrow)
EnvAdd, target, 1, d
}
; Calculate how many seconds until the target time is reached.
EnvSub, target, %A_Now%, Seconds
; Sleep until the target is reached.
Sleep, % target * 1000 ; (milliseconds)
; Send key Alt+q
SendInput,{Alt Down}q{Alt Up}
https://autohotkey.com/board/topic/1996 ... ime/page-2
HTH