Jump to content

Remote Media Control


ConsultingJoe
 Share

Recommended Posts

I made this because I needed a easy way to control the music of the computer next to me while I'm gaming.

How to use:

1.) Run the server on the target computer.

2.) Run the client on the controlling computer.

3.) Enter the target computer name in the client.

4.) Run your favorite music player on the target computer.

5.) Use the media keys on the client computer to change the music on the target computer.

Keys available: (Pause/Play, Stop, Next, Previous)

Enjoy!

CLIENT

TCPStartUp()
Dim $szServerPC = InputBox( "Remote Media Control Client", "Enter the server computer's network name." )
If @error Then Exit
Dim $szIPADDRESS = TCPNameToIP($szServerPC)
Dim $nPORT = 33891
Dim $ConnectedSocket = -1
$ConnectedSocket = TCPConnect($szIPADDRESS,$nPORT)
Dim $szData
If @error Then
    MsgBox(4112,"Error","TCPConnect failed with WSA error: " & @error)
Else
    HotKeySet( "{MEDIA_PLAY_PAUSE}", "play" )
    HotKeySet( "{MEDIA_STOP}", "stop" )
    HotKeySet( "{MEDIA_NEXT}", "nextsong" )
    HotKeySet( "{MEDIA_PREV}", "backsong" )
    While 1
        Sleep(100)
    WEnd
EndIf
Func play()
    sendcmd("play")
EndFunc
Func stop()
    sendcmd("stop")
EndFunc
Func nextsong()
    sendcmd("next")
EndFunc
Func backsong()
    sendcmd("back")
EndFunc
Func sendcmd($szData)
    TCPSend($ConnectedSocket,$szData)
    If @error Then Exit
    TCPSend($ConnectedSocket,"")
    If @error Then Exit
EndFunc

SERVER

Dim $szIPADDRESS = @IPAddress1
Dim $nPORT = 33891
TCPStartUp()
$MainSocket = TCPListen($szIPADDRESS, $nPORT)
If $MainSocket = -1 Then Exit
Dim $ConnectedSocket = -1
Do
    $ConnectedSocket = TCPAccept($MainSocket)
Until $ConnectedSocket <> -1
Dim $szIP_Accepted = SocketToIP($ConnectedSocket)
Dim $msg, $recv
While 1
    $recv = TCPRecv( $ConnectedSocket, 2048 )
    If @error Then ExitLoop

    If $recv <> "" Then
        Switch $recv
            Case "play"
                Send("{MEDIA_PLAY_PAUSE}")
            Case "stop"
                Send("{MEDIA_STOP}")
            Case "next"
                Send("{MEDIA_NEXT}")
            Case "back"
                Send("{MEDIA_PREV}")
        EndSwitch
    EndIf
WEnd
If $ConnectedSocket <> -1 Then TCPCloseSocket( $ConnectedSocket )
TCPShutDown()
Func SocketToIP($SHOCKET)
    Local $sockaddr = DLLStructCreate("short;ushort;uint;char[8]")

    Local $aRet = DLLCall("Ws2_32.dll","int","getpeername","int",$SHOCKET, _
            "ptr",DLLStructGetPtr($sockaddr),"int_ptr",DLLStructGetSize($sockaddr))
    If Not @error And $aRet[0] = 0 Then
        $aRet = DLLCall("Ws2_32.dll","str","inet_ntoa","int",DLLStructGetData($sockaddr,3))
        If Not @error Then $aRet = $aRet[0]
    Else
        $aRet = 0
    EndIf

    $sockaddr = 0

    Return $aRet
EndFunc
Edited by CyberZeroCool

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

2 bad I don't have 2 computers but the idea it's really cool :) Gives me a few other ideas.

Thanks, yeah it seems to work great.

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Updated, was missing a few lines of code. check first post.

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Hmmm.... This could be useful as hell for one of those audio systems that goes through the house, wit speakers every where, and is controlled by a computer. You could be all on you laptop, and be like "hey dude , watch this!" *click*, and an awesome song starts going through the house. oohhhh so cool. Or maybe add internet capabilitie so you could send messages star trek style home. And they could send it back o_0. Ok I'm getting off topic but that would be awesome....

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

Hmmm.... This could be useful as hell for one of those audio systems that goes through the house, wit speakers every where, and is controlled by a computer. You could be all on you laptop, and be like "hey dude , watch this!" *click*, and an awesome song starts going through the house. oohhhh so cool. Or maybe add internet capabilitie so you could send messages star trek style home. And they could send it back o_0. Ok I'm getting off topic but that would be awesome....

Yeah, you can easily make it internet capable.

Let's say you are bringing a date home, you can start the girls favorite song just as you walk in. What a turn on.

And no, not a Trojan.

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Don't see how you could send home a trojan through that but maybe. :shrugs: And ya, thats not a bad idea...

*Runs to set up speakers throughout the house and add cellphone support...*

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

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...