Suite à cette discussion Bouton pour baisser le volume du son

L'interface HTA
Nom : Image2.gif
Affichages : 28
Taille : 7,8 Ko
Les auteurs du code: patricktoulon, omen999, hackoofr, ProgElecT
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<html>
	<head>
	<title> Volume + - ON/OFF </title>
		<HTA:APPLICATION 
			APPLICATIONNAME="Volume + - ON/OFF" 
			BORDER="THIN" 
			BORDERSTYLE="NORMAL" 
			ICON="SndVol.exe" 
			INNERBORDER="NO" 
			MAXIMIZEBUTTON="NO" 
			MINIMIZEBUTTON="NO" 
			SCROLL="NO" 
			SELECTION="NO" 
			SINGLEINSTANCE="YES" 
		>
		<!-- Discussion source: -->
		<!-- https://www.developpez.net/forums/d1442833/autres-langages/general-visual-basic-6-vbscript/vbscript/bouton-baisser-volume/ -->
	</head>
	<script language="vbscript">
	'************************************************************************************
	Sub Window_Onload()
		CenterWindow 222,163
	End Sub
	'************************************************************************************
	Sub Volume(Param1,Param2,Param3)
		set oShell = CreateObject("WScript.Shell") 
		oShell.SendKeys Param1 & chr(Param2) & Param3
		'--------------------------- MEMO ----------------------------------
		'oShell.SendKeys "{" & chr(175) & " 50}" 'volume maximum 100%
		'oShell.SendKeys "{" & chr(174) & " 50}" 'volume minimum 0% 
		'oShell.SendKeys "{" & chr(175) & " 10}" 'volume +20%
		'oShell.SendKeys "{" & chr(174) & " 10}" 'volume -20%
		'oShell.SendKeys chr(173) 'permet de couper/remettre le son (bascule)
		set oShell = NotHing
	End Sub
	'*************************************************************************************
	Sub CenterWindow(x,y)
		Dim iLeft,itop
		window.resizeTo x,y
		iLeft = window.screen.availWidth/2 - x/2
		itop = window.screen.availHeight/2 - y/2
		window.moveTo ileft,itop
	End Sub
	'************************************************************************************
	</script>
	<body>
		<center>
			<BUTTON onClick="Call Volume('{','175',' 50}')" style="background: Red; color: white;WIDTH: 85px; HEIGHT: 30px">Volume MAX </BUTTON>&nbsp;&nbsp;
			<BUTTON onClick="Call Volume('{','174',' 50}')" style="background: Blue; color: white;WIDTH: 85px; HEIGHT: 30px">Volume MIN </BUTTON>&nbsp;
			<BUTTON onClick="Call Volume('{','175',' 10}')" style="background: Green; color: white;WIDTH: 85px; HEIGHT: 30px">Volume +20% </BUTTON>&nbsp;&nbsp;
			<BUTTON onClick="Call Volume('{','174',' 10}')" style="background: Orange; color: white;WIDTH: 85px; HEIGHT: 30px">Volume -20% </BUTTON>&nbsp;<hr>
			<BUTTON onClick="Call Volume('','173','')"      style="background: grey; color: white;WIDTH: 70px; HEIGHT: 30px">ON/OFF</BUTTON>
		</center> 
	</body>
</html>
Pour une utilisation dans un simple VBScript, il vous suffit de la Sub Volume(Param1,Param2,Param3)