Toggling Tray Icon after Task Scheduler Startup

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
petahbred
Posts: 1
Joined: 04 Jul 2019, 04:40

Toggling Tray Icon after Task Scheduler Startup

04 Jul 2019, 04:53

I have a script running the following code:

Code: Select all

if (Toggle) {
  Menu, Tray, Icon, %A_ScriptDir%/speaker.png,,1
}
else {
  Menu, Tray, Icon, %A_ScriptDir%/headphones.png,,1
}
return
It successfully changes the tray icon when executed by double-clicking the .ahk file.
I have a shortcut in my start up programs directory: %AppData%\Roaming\Microsoft\Windows\Start Menu\Programs\Startup, and it is able to toggle the tray icon successfully after logging into Windows.

Problem:
My problem is that using Task Scheduler to start up the script doesn't allow me to toggle the Tray Icon. I know the script is working because the other parts of the script are functional.
Running the script manually via the Task Scheduler GUI works just fine.
Restarting the computer and logging in does NOT work.
Signing out and signing back in does NOT work.

The reason I'm using Task Scheduler is for admin privileges.

Task Scheduler settings:
Trigger: At log on of any user
Actions: Start a program <my script>
Run with highest privileges.


Anyone have any thoughts on what I could be doing wrong?
Thanks in advance for the help!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, Google [Bot], Spawnova and 329 guests