I have no clue why it isn't working. Is something wrong with the logic in my if statements or is there something finicky about the way Windows' app volumes are handled? Assistance needed.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;#NoTrayIcon
Loopstart:
FileRead, headphones_flag, M:\Portfolio\Smart Home Projects\headphones_flag.txt
IfInString, headphones_flag, 0
{
;;;;;;;;;;;;; MONDAY - THURSDAY
if (A_WDay == 2 or A_WDay == 3 or A_WDay == 4 or A_WDay == 5)
{
if (A_Hour <= 8 or A_Hour >= 21)
Run, X:\Apps\Audio\SoundVolumeView\SoundVolumeView.exe /SetVolume eventghost.exe 30
if (A_Hour > 8 and A_Hour < 21)
Run, X:\Apps\Audio\SoundVolumeView\SoundVolumeView.exe /SetVolume eventghost.exe 50
}
;;;;;;;;;;;;;;;;;;;FRIDAY
if (A_WDay == 6)
{
if (A_Hour <= 8 or A_Hour >= 21)
Run, X:\Apps\Audio\SoundVolumeView\SoundVolumeView.exe /SetVolume eventghost.exe 30
if (A_Hour > 8 and A_Hour < 21)
Run, X:\Apps\Audio\SoundVolumeView\SoundVolumeView.exe /SetVolume eventghost.exe 50
}
;;;;;;;;;;;;;;;;;;;7 is SATUUUR
if (A_WDay == 7)
{
if (A_Hour <= 8 or A_Hour >= 21)
Run, X:\Apps\Audio\SoundVolumeView\SoundVolumeView.exe /SetVolume eventghost.exe 30
if (A_Hour > 8 and A_Hour < 21)
Run, X:\Apps\Audio\SoundVolumeView\SoundVolumeView.exe /SetVolume eventghost.exe 50
}
;;;;;;;;;;;;;;;;;;;1 is SUNDAY
if (A_WDay == 1)
{
if (A_Hour <= 8 or A_Hour >= 21)
Run, X:\Apps\Audio\SoundVolumeView\SoundVolumeView.exe /SetVolume eventghost.exe 30
if (A_Hour > 8 and A_Hour < 21)
Run, X:\Apps\Audio\SoundVolumeView\SoundVolumeView.exe /SetVolume eventghost.exe 50
}
}
Sleep, 1800000 ; 30 min
Goto, Loopstart