Jump to content

Play Alarm Sound on an other PC over LAN


Recommended Posts

Hi,

Can I play an Alam Sound on a Remote PC via LAN ?

Can I Stop the Alarm Sound on a Remote PC immediately ?

Can I control the Sound Volume remotly?

Tanks

br. Tom

Here I just wrote this specifically for what you asked. It plays a "notify.wav" but you have to tell it to. Only plays the "notify.wav" for its length which is 5seconds if that. Havn't set it up to allow Volume adjustment.

Compile and Place on Remote PC:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------
HotKeySet("{PAUSE}","Quit");Press PAUSE key to exit

#NoTrayIcon

Global $SERVER_IP = "127.0.0.1"
Global $SERVER_PORT = 65432
Global $SERVER

; Commands
Global $ALARM = "/play alarm"

TCPStartup()
$SERVER = TCPListen($SERVER_IP,$SERVER_PORT,4)
If @error Then Exit
Do
    $SOCKET = TCPAccept($SERVER)
    Sleep(10)
Until $SOCKET > 0

If $SOCKET > 0 Then
    $ClientIP = @IPAddress1
    $ClientUN = @UserName
    $ClientCN = @ComputerName
    $ClientOS = @OSVersion
    MsgBox(0,"Server", $ClientUN & " on " & $ClientCN & " running " & $ClientOS & " has connected with the following Ip Address:" & $ClientIP )
EndIf

While True
    $RECV = TCPRecv($SOCKET,256)
    If $RECV = $ALARM Then
        SoundSetWaveVolume(75)
        SoundPlay(@WindowsDir & "\media\notify.wav",1)  
    EndIf
    Sleep(20)
WEnd

Func Quit()
    TCPCloseSocket($SERVER)
    TCPShutdown()
    Exit
EndFunc

Compile and Place on Administrative PC:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------
HotKeySet("^s","SendMsg");Press CTRL+S to send a message to server.
HotKeySet("^q","Quit");Press CTRL+Q to quit

Global $SERVER_IP = "127.0.0.1"
Global $SERVER_PORT = "65432"
Global $SOCKET

; Start The TCP Services
TCPStartUp()

; Connect to The Server
$socket = TCPConnect( $SERVER_IP, $SERVER_PORT )
If $socket = -1 Then Exit
    
If @error Then
    MsgBox(0, "Client", "Unable to Contact Server!")
    Exit
Else
    MsgBox(0, "Client","Successfully Connected to the Server!",1)
EndIf

While True
    $RECV = TCPRecv($SOCKET,256)
    If $RECV <> "" Then 
        MsgBox(0, "Client", $RECV,1)
    Sleep(20)
EndIF
WEnd

Func SendMsg()
    $MESSAGE = InputBox("Client","Message to Send to Server:","Your Message Here")
    TCPSend($SOCKET,$MESSAGE)
EndFunc

Func Quit()
    TCPCloseSocket($SOCKET)
    TCPShutdown()
    Exit
EndFunc

May be some unecessary code..

CTRL+S will open a input box, type: /play alarm and, it will play "notify.wav" on the remote pc. Unsure if this works across Internet but does work on Network.

As well you will have to change the IP Address on the Remote PC script to point towards your subnet address,etc,etc,etc.

Upon Successful connection the Server will display a message box telling the user who connected.

You can also ignore using "/" and it will create a Message Box on the Remote PC with any message you typed via the input box.

Edited by BlackDawn187
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...