From f5d58594bb1a779b687518f76dc12d964a408cf1 Mon Sep 17 00:00:00 2001 From: borislav nikolov Date: Thu, 5 Oct 2023 17:09:22 +0200 Subject: [PATCH] fix --- projects/panic/cards/lower_sound.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/projects/panic/cards/lower_sound.py b/projects/panic/cards/lower_sound.py index 49e2d442..e7c87f9b 100644 --- a/projects/panic/cards/lower_sound.py +++ b/projects/panic/cards/lower_sound.py @@ -1,16 +1,19 @@ # pip install pywin32 import win32api -import win32con +import win32gui import time import random +WM_APPCOMMAND = 0x319 +APPCOMMAND_VOLUME_DOWN = 0x90000 + def decrease_sound(): win32api.SendMessage( - -1, - win32con.WM_APPCOMMAND, - 0, - win32con.APPCOMMAND_VOLUME_DOWN - ) + win32gui.GetForegroundWindow(), + WM_APPCOMMAND, + 0, + APPCOMMAND_VOLUME_DOWN + ) # slowly decrease the volume every 1 to 30