Script Failing to Run Via Task Scheduler

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
MaxAstro
Posts: 557
Joined: 05 Oct 2016, 13:00

Script Failing to Run Via Task Scheduler

04 Mar 2019, 10:45

I'm trying to set up a simple script that refreshes a browser window every hour automatically. The script itself is straightfoward and works fine:

Code: Select all

#NoEnv                       	; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn                      	; Enable warnings to assist with detecting common errors.
#SingleInstance force			; Automatically update the script if it is run while already running.
SendMode Input               	; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% 	; Ensures a consistent starting directory.
SetFormat, FloatFast, 0.2		; Round decimals to two digits
CoordMode, Mouse, Window		; Sets click commands to be relative to the current window
#LTrim							; Continuation sections ignore indentation (if you don't know what this means, don't touch it)

; Gets the control ID of Google Chrome
ControlGet, controlID, Hwnd,,Chrome_RenderWidgetHostHWND1, ahk_class Chrome_WidgetWin_1

; Focuses on Chrome without breaking focus on what you're doing
ControlFocus,,ahk_id %controlID%
		
; Refreshes Chrome
ControlSend, Chrome_RenderWidgetHostHWND1, ^r, ahk_class Chrome_WidgetWin_1

ExitApp
(I know, I have some settings at the top that don't need to be there, just my default "new script" stuff that I didn't bother to delete)

However, when I compile the script and try to run it via Task Scheduler, no matter what settings I use it refuses to run. Task Scheduler says "Running" (but never actually runs the script) and just... sits there.

If I manually double-click the script it works fine, though.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Lamron750, septrinus, songdg and 261 guests