The good news is that the script works as intended when the Streaming Audio Recorder program is active, as the sound will not play; however, regardless of whether the checkbox is checked or not, the sound still plays. Does anyone have any advice for getting the sound not to play when the checkbox is unchecked? The condition of the checkbox seems to have no impact on the execution of the sound file. Any help is appreciated. Thank you.
Code: Select all
#Persistent
I_Icon = %A_MyDocuments%\Autohotkey Icons\exclamation_icon.ico
IfExist, %I_Icon%
Menu, Tray, Icon, %I_Icon%
SetTimer, ShowTooltip, 120000 ; I lowered the timer so that the sound plays every couple of minutes just for testing purposes.
Gui, Add, Button, xm ym+20, Play Sound
Gui, Add, Checkbox, vSoundEnabled xm ym+40, Play sound
; Set SoundEnabled to 1 to enable sound by default
SoundEnabled := 1
Gui, Show, w200 h70, Price Check Reminder
ButtonPlaySound:
; Check if the SoundEnabled variable is equal to 1
if (SoundEnabled = 1) {
; Play the wave file
Process, Exist, Streaming Audio Recorder.exe
if !ErrorLevel {
SoundGet, currentVolume
SoundSet, 50
SoundPlay, %A_MyDocuments%\Autohotkey Sounds\tooltip_message.wav
SoundSet, %currentVolume%
}
}
return
ShowTooltip:
ToolTip, Remember to check chat!
; Check if the SoundEnabled variable is equal to 1
if (SoundEnabled = 1) {
Process, Exist, Streaming Audio Recorder.exe
if !ErrorLevel {
SoundGet, currentVolume
SoundSet, 50
SoundPlay, %A_MyDocuments%\Autohotkey Sounds\tooltip_message.wav
SoundSet, %currentVolume%
}
}
Sleep, 5000
ToolTip
return