Jump to content
Sign in to follow this  
timmy2

A simple script that demonstrates controlling Zoom Player via TCP

Recommended Posts

Pasted below is a short, simple AutoIt script that I wrote to test TCP control of Zoom Player Max (ZP) . The functions available are at this link.

May it help someone in the future.

Thank you to BrewManNH and TheSaint for their help in other threads I started. :thumbsup:

;simple AutoIt script for controlling Zoom Player via TCP

HotKeySet("{ESC}", "Terminate") ;ESC to bail out

;these will be used when I open the TCP socket
$ip = "127.0.0.1"
$port = "4769"

;start TCP service
TCPStartup()

;open TCP socket and see if it was successful
$socket = TCPConnect( $ip, $port )

If $Socket = -1 Then
      MsgBox(4096,"Error","Failed to connect to ZP via TCP on localhost at port 4769.")
      Terminate()
EndIf

;now loop, presenting Text Input prompt for user to enter a ZP function and optional parameters.
while 1

    ;text entry prompt with Cancel button
    $msg = InputBox("ZP TCP Controller","Enter text to send via TCP (default is play). Or Cancel to exit.): ", "5100 fnPlay" & @CRLF)
    if @error = 1 then Terminate()

    ;@CRLF needed at end of text to be sent!
    $msg = $msg & @CRLF

    ;the rubber meets the road here
    $send = TCPSend($socket, $msg)

WEnd

Terminate()

Func Terminate() ;process ESC key and close TCP

    TCPCloseSocket($socket)
    TCPShutdown()
    Exit 0

EndFunc

If anyone wants to add the ability to receive responses from Zoom Player I would welcome the addition.  Here's a link to a very clear explanation of communicating via TCP with ZP via Autohotkey, including receiving the info ZP sends back up the pipe.  Also, here's a link to download a neat TCP testing tool written in Delphi for the ZP community. Zoom Player is a great video player in my opinion, with inspiring depth AND incredible documentation.

 

Share this post


Link to post
Share on other sites

Very good, happy we could help, but you should get a Mod to relocate this to the Examples section, where it really belongs. :)


Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

Very good, happy we could help, but you should get a Mod to relocate this to the Examples section, where it really belongs. :)

 

I had hoped that I could get some advice on how to add "receive" capability before making it a pure example-only post. I'll edit my post to emphasize that.

Share this post


Link to post
Share on other sites

For the moment your script is only a basic tcp client, nothing related to ZP; just to say  :rolleyes: .

Therefore if you need help you should edit the title of the topic, to avoid any confusion.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

For the moment your script is only a basic tcp client, nothing related to ZP; just to say  :rolleyes: .

Therefore if you need help you should edit the title of the topic, to avoid any confusion.

 

If Zoom Player is loaded with a video my script can by default send the Play command. The user has the option to enter other ZP functions or commands to test them.  That's more than existed previously in these or ZP's forums.

Share this post


Link to post
Share on other sites

ah. I didn't see the line because it's half truncated.

If you want to receive the resp of the command use the TCPRecv function.

$sResp = TCPRecv($socket, 1024)
If $sResp <> "" Then
    ConsoleWrite($sResp & @CrLf)
EndIf

 

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

ah. I didn't see the line because it's half truncated.

If you want to receive the resp of the command use the TCPRecv function.

$sResp = TCPRecv($socket, 1024)
If $sResp <> "" Then
    ConsoleWrite($sResp & @CrLf)
EndIf

Br, FireFox.

 

Thank you! I'll try your suggestion as soon as I finish helping a few clients.  The part about receiving I wondered about is whether the script has to wait in a loop, with a timeout, or if there's some sort of buffering available.  The demo program written in Delphi I cited in my original post inspired me to be curious about how to receive the default feedback ZP sends. In my current application I have no need to fetch any info from ZP but while I'm exploring using TCP with it I'd like to nail all the basics, and ZP can be asked for lots of information via TCP.  Thanks again, FireFox.

Share this post


Link to post
Share on other sites

Put this code in your loop, the buffer is internaly handled (its size is 4096 bytes here).


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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
Sign in to follow this  

  • Similar Content

    • By tarretarretarre
      Autoit-Socket-IO
      Introduction
      Autoit-Socket-IO is a event driven TCP/IP wrapper heavily inspired from Socket.IO with focus on user friendliness and long term sustainability.
      I created this UDF because I was fascinated how Socket.IO made a such scary task "reliable and secure networking" so simple for the developer. So this was my main motivation.
      I constantly want to make this UDF faster and better, so if you have any suggestions. Do not hesitate to make requests!
      Features
      Flexiable and easy to understand API Above avarage documentation "Fully featured" examples Security in form of data encryption and middleware-support Limitations
      Speed. Because I want this UDF to be as flexible and simple as possible. Sometimes speed is sacrificed, but that does not mean i don't try to . It is not possible to emit objects mainly because autoit does not support serialization. Only 1D-arrays can be emitted (2D arrays will probably never be supported) Success story
      Since December 2017-now I have used version 1.5.0 in an production environment for 40+ clients with great success, the only downtime is planned windows updates and power outages.
      Getting started
      Download the script from AutoIt or pull it from the official github repo git@github.com:tarreislam/Autoit-Socket-IO.git and checkout the tag 2.0.0 The documentation is located at Docs\index.html Take a look in the examples/ folder Changelog
      Version 2.0.0 (This update break scripts. Please consult the upgrade.md for guidance)
      All global internal variables has been renamed. Added a bunch of new API methods: _Io_RegisterMiddleware, _Io_whoAmI, _Io_IsClient, _Io_IsServer, _Io_getAllByProperty and _Io_getFirstByProperty and some more. Read more about these in the documentation. _Io_socketGetProperty now has a setter method called _Io_socketSetProperty which can be used to set custom properties. _Io_socketGetProperty now has a third parameter "default" which is used when a property is not found Removed _Io_setEventPostScript and _Io_setEventPretScript in favor of _Io_RegisterMiddleware Improved documentation (It still needs some love though) Improved the verbosity of _Io_DevDebug  
      Newest version (2019-09-29!)
      Autoit-Socket-IO-2.0.0.zip
      Older versions (Not supported anymore)
      Autoit-Socket-IO-1.0.0.zip Autoit-Socket-IO-1.1.0.zip Autoit-Socket-IO-1.3.0.zip Autoit-Socket-IO-1.4.0.zip Autoit-Socket-IO-1.5.0.zip
    • By AoRaToS
      I started working on this program in the summer of 2008 then I stopped cause I faced some problems I couldn't overcome back then. Now that I've practiced more and have become a better scripter/programmer I'm releasing the program to the public to get some opinions. I know it's not a new concept but it's the first program I started besides some small stuff I did just for practice! I won't post the source code yet because it's still under construction, although I'm sure I've posted early stages of the code with bugs in the past in some topic...
      What I wanted was a simple, small, serverless program that would work without installation cause I wanted it for where I work, so I ended up with this!
      I have attached some images of various versions, also visit the forum thread.
      The package includes s!mpL3 LAN Messenger and the full change log.
      Current version 2.9.9.1! [04/07/2019]
      Check the Change Log below!
       
       
      http://www.autoitscript.com/forum/index.php?showtopic=88782
       
       
       
      Read the license before using this software.
       
    • By HansHenrik
      ----------
      edit: this is probably in the wrong place, can a moderator move it to wherever it belongs?
      ----------

      is there any way to completely disable TCPTimeout and make TCPRecv() wait indefinitely? maybe setting it to 0 or -1 or something? 
      the docs doesn't seem to mention any way to disable it

      - the underlying C code would set SO_RCVTIMEO to 0 , aka

      DWORD timeout=0;
      setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
    • By ripdad
      I have had several people ask for this, so I decided to work the algorithm for it and this is the result.
      What is it?
      A Gateway Proxy Sends and Receives Data Unmodified.
      https://en.wikipedia.org/wiki/Proxy_server
      What is it used for?
      You can use it as a gateway, relay or router between two known static IP addresses.
      More information is in the header of the script.
      Download: LocalGatewayProxy.au3
      You will need WSA_NBTCP.au3 from here:
      https://www.autoitscript.com/forum/topic/191954-wsa_nbtcp-v100-udf/
      If you have any questions or problems, let me know.
       
    • By ripdad
      This script is based on algorithm code from EnrMa.
      Updated: January 22, 2018
      Made improvements. Changes are in the script header.
      Known Issues: AutoIt x64 does not work properly with this script.
      Download: LocalProxyServer_v1.00.zip
       
×
×
  • Create New...