Tek tuşla arkadaki uygulamaları susturma

hasbutcu

Kilopat
Katılım
17 Aralık 2018
Mesajlar
66
Daha fazla  
Cinsiyet
Erkek
Selam,
Örneğin Valorant oynarken arkada Spotify açık ben clutcha kaldığım sırada vs. belirli tuşa tıkladığım zaman sadece Valorant'ın sesi duyulacak ve arkadaki sesler kesilecek. Spotify'den hariç bir şey açıksa örneğin Discord vesaire veya örneğin tuşa tıkladığımda Spotify'daki ses seviyesini %50'ye çekecek.

Böyle bir program var mı?
 
Son düzenleyen: Moderatör:
from pycaw.pycaw import AudioUtilities
import win32gui
import win32process
import time
import keyboard

def 1(uygulama_ad="xxxx", sessiz=1):
def uygulama2():
pencere = win32gui.FindWindow(None, uygulama_ad)
if pencere != 0:
_, pid = win32process.GetWindowThreadProcessId(pencere)
return pid
return None

def 2():
try:
acik_penc= win32gui.GetClassName(win32gui.GetForegroundWindow())
except win32gui.error:
acik_penc= "??"
return acik_penc== uygulama_ad

def 3(pid, sessiz):
acc= AudioUtilities.GetAllSessions()
for acc1 in acc:
if acc1.Process and acc1.Process.pid == pid:
acc1.SimpleAudioVolume.SetMute(sessiz, None)

while True:
if keyboard.is_pressed('enter'):
pid = uygulama2()
if pid:
3(pid, 1)
time.sleep(1)

1()
 
Kodlama bilmiyorum ne yapmam gerektiğini söyleyebilir misiniz.
Sanırım python'la yapacaksın.

from pycaw.pycaw import AudioUtilities
import win32gui
import win32process
import time
import keyboard

def 1(uygulama_ad="xxxx", sessiz=1):
def uygulama2():
pencere = win32gui.FindWindow(None, uygulama_ad)
if pencere != 0:
_, pid = win32process.GetWindowThreadProcessId(pencere)
return pid
return None

def 2():
try:
acik_penc= win32gui.GetClassName(win32gui.GetForegroundWindow())
except win32gui.error:
acik_penc= "??"
return acik_penc== uygulama_ad

def 3(pid, sessiz):
acc= AudioUtilities.GetAllSessions()
for acc1 in acc:
if acc1.Process and acc1.Process.pid == pid:
acc1.SimpleAudioVolume.SetMute(sessiz, None)

while True:
if keyboard.is_pressed('enter'):
pid = uygulama2()
if pid:
3(pid, 1)
time.sleep(1)

1()
Sondaki time.sleep denen arkadaşı anlamadım hocam, sessize almak yerine uykuya mı alıyoruz uygulamayı?
 

Technopat Haberler

Yeni konular

Geri
Yukarı