Press key at exactly 20:00

Get help with using AutoHotkey and its commands and hotkeys
lefteris_ele
Posts: 3
Joined: 18 Sep 2020, 16:25

Press key at exactly 20:00

18 Sep 2020, 16:46

Hey guys I think this might be a simple one for you guys. I just need the script to press "space" at 20:00. That's it. Can anyone help?
User avatar
ositoMalvado
Posts: 43
Joined: 24 Dec 2019, 12:02

Re: Press key at exactly 20:00

18 Sep 2020, 16:51

Try this

Code: Select all

Loop{
	Loop{
		if(A_Hour==20 and A_Min==00){
			SendInput, {space}
			break 
		}
	}
	sleep 70000
}
MrDoge
Posts: 41
Joined: 27 Apr 2020, 21:29

Re: Press key at exactly 20:00

18 Sep 2020, 17:47

use task scheduler to run a script that sends space at 20:00
the script can be
Send, {space}
User avatar
Yakshongas
Posts: 591
Joined: 21 Jan 2020, 08:41
Facebook: Yakshongas

Re: Press key at exactly 20:00

18 Sep 2020, 18:51

Check once every 35 sec to see if the hour is the indicated, and if it is sends the Enter key, if it's not wait another 35 sec, also has a low CPU use (0%) and low Ram use (Less than 3Mb)

Code: Select all

Loop
{
    If (A_Hour == 20) && (A_Min == 00)
    {
        Send, {Space}
        Return ;If you want to keep the script running after sending enter remove this Return.
    }
    Else
    {
        Sleep, 35000 ;35 Sec
    }
}
Please mark your topics as solved if you don't need any further help. ✅

Need a little more help? Discord : Yakshongas#9893 🕹
lefteris_ele
Posts: 3
Joined: 18 Sep 2020, 16:25

Re: Press key at exactly 20:00

19 Sep 2020, 03:01

Hey guys thanks for the quick replies. They don't seem to work though.
User avatar
Chunjee
Posts: 696
Joined: 18 Apr 2014, 19:05
GitHub: Chunjee

Re: Press key at exactly 20:00

19 Sep 2020, 03:16

I think a timer would be more efficient and if you put it every 1 min it can't miss the time.
User avatar
flyingDman
Posts: 860
Joined: 29 Sep 2013, 19:01

Re: Press key at exactly 20:00

19 Sep 2020, 21:49

Have you tried what @MrDoge is suggesting?
lefteris_ele
Posts: 3
Joined: 18 Sep 2020, 16:25

Re: Press key at exactly 20:00

20 Sep 2020, 12:38

Yes I did and still nothing.
gwarble
Posts: 459
Joined: 30 Sep 2013, 15:01

Re: Press key at exactly 20:00

21 Sep 2020, 22:04

once or every day at 20:00?

untested example but I use this function a lot:

Code: Select all

SetTimer, PressKeyAtExactly200000, % -Until("200000") ;run once at the next 20:00

Code: Select all

Until(Time="000000",Units="ms") { ;2016 gwarble
 FormatTime, _, %A_Now%, yyyyMMdd ;returns ms until time
 _ .= Time
 EnvSub, _, %A_Now%, s
 If (_ < 1)
  _ +=  24 * 60 * 60 ; add a day (in milliseconds)
 Return _*1000
}
if you want the subroutine to repeat every day at 20:00 put this at the end:

Code: Select all

PressKeyAtExactly200000:
 Send blah blah
 SetTimer, %A_ThisLabel%, % -Until("200000") 
Return
EitherMouse - Multiple mice, individual settings . . . . www.EitherMouse.com . . . . forum . . . .

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Bodhi, boiler, bxgchoi, mikeyww, robertmiller, Xtra and 62 guests