Stop AutoHotKey script from starting before Windows login?

128 views Asked by At

I am trying to make an AutoHotKey script that starts a certain program (Cold Turkey Blocker) a few seconds after I log in with my Windows account. The script itself runs without problems when started manually or if I start the PC and enter my password very quickly. If I take too long, the program will have already been opened with the script being stuck after merely opening the program. Additionally, my mouse cursor will be laggy for few minutes. There are no other Autostart programs (shell:startup) and the program won't open by itself.

I tried to do it with Task Scheduler too (Start on Logon with the desired user selected), it lead to the same issue with the program opening before I login (I can hear my PC fans getting louder while typing my password).

I'm using Win 11 and I'm on the admin account. I have one separate (local) standard user.

The AutoHotKey script:

Sleep, 5000
Run, "C:\Program Files\Cold Turkey\Cold Turkey Blocker.exe"
WinWaitActive, Cold Turkey Blocker Pro (v4.4)
WinActivate
WinMaximize
; Click Statistics
Sleep, 2000
ButtonX := 124
ButtonY := 277
MouseMove, %ButtonX%, %ButtonY%
Click

; Click Website Statistics
Sleep, 500
ButtonX := 611
ButtonY := 70
MouseMove, %ButtonX%, %ButtonY%
Click

; Click This Week
Sleep, 500
ButtonX := 494
ButtonY := 237
MouseMove, %ButtonX%, %ButtonY%
Click

; Click Last month
Sleep, 500
ButtonX := 503
ButtonY := 317
MouseMove, %ButtonX%, %ButtonY%
Click

; Click Refresh
Sleep, 500
ButtonX := 1724
ButtonY := 296
MouseMove, %ButtonX%, %ButtonY%
Click

; Move Mouse to avoid it being stuck at last position
Sleep, 500
MouseMove, 500, 400

ExitApp
0

There are 0 answers