Jump to content

Ton bei WinXP per BAT oder VBS ab und anschalten ?


noxx

Recommended Posts

Weiß einer, wie man mit einem Script den Ton am PC an und ausschalten kann?

Win32::Sound::Stop()

 

oder volume:

 

Win32::Sound::Volume(0);

Win32::Sound::Volume(65535);

 

oder

 

Win32::Sound::Volume('0%');

Win32::Sound::Volume('100%');

 

Win32::Sound::Volume('100%' , '80%'); reduciert das rechter kanal

 

Script nun erst nach das windows volume fur rechts un links abfragen.

 

($L, $R) = Win32::Sound::Volume();

 

Dan mit if .... oder

Win32::Sound::Volume('0%'); oder Win32::Sound::Volume('100%'); ausfuhren.

 

Das wirkt nicht mit ein eingeschrankte konto.

Link to comment
Danke, aber wie benutze ich das? Habe es mal mit dem Befehl Win32::Sound::Stop() probiert, aber weder in einer BAT noch in einer VBS gehts

 

 

Win32::Sound::Stop()

 

geht nur als etwas spielt.

 

Besser volume gebrauchen.

Link to comment

Die Antwort bezieht sich vermutlich auf die PERL Shell, nix BAT oder VBS.

 

Ich hab' mal ein bißchen gesucht: richtig häßlich, wohl mit einem Hilfstool Mute.exe, aber weder mit WMI (das wäre dann via VBS) oder PowerShell (der große Bruder der BAT) habe ich etwas vorgefertiges gefunden. Daher vielleicht mal das PERL Dingens anschauen...

 

Jochen

Edited by JMS
Link to comment

Vermutlich wird es ber VBS/BAT ohne Weiteres nicht funktionieren...

 

Da müsste man eine eigene sehr kleine "ToggleMute"-Applikation programmieren.

 

Technisch SOLLTE es prinzipiell so funktionieren:

Man sendet über Win32 API-Funktion SendMessage (in user32.dll) die Nachricht

APPCOMMAND_VOLUME_MUTE.

 

Hier ein Code-Schnipsel in VB.NET (habe ich im Netz gefunden):

 

Public Class Form1

Private Const APPCOMMAND_VOLUME_MUTE As Integer = &H80000

Private Const WM_APPCOMMAND As Integer = &H319

Declare Function SendMessageW Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr

 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

SendMessageW(Me.Handle, WM_APPCOMMAND, Me.Handle, CType(APPCOMMAND_VOLUME_MUTE, IntPtr))

End Sub

End Class

 

 

 

jnmarczi

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...