vMix Forums
»
General
»
General Discussion
»
Sending http requests to Companion 3.x in script
Rank: Newbie
Groups: Registered
Joined: 5/16/2021(UTC) Posts: 8 Thanks: 1 times
|
Hi Folks
Anyone have some sample code to send an Http Post request to press a button in Companion 3.x from a vmix script.
Thanks
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,243 Location: Belgium Thanks: 294 times Was thanked: 960 time(s) in 794 post(s)
|
Originally Posted by: Mollertom Hi Folks
Anyone have some sample code to send an Http Post request to press a button in Companion 3.x from a vmix script.
Thanks Could be mistaken but am guessing that "button" performs an action/function for vMix so am wondering why not do this strait from the script ? Btw have you searched the forum for Http request or google for vb.net Httprequest
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 2/18/2014(UTC) Posts: 1,838 Location: Stockholm
Thanks: 144 times Was thanked: 297 time(s) in 250 post(s)
|
Originally Posted by: doggy Originally Posted by: Mollertom Hi Folks Anyone have some sample code to send an Http Post request to press a button in Companion 3.x from a vmix script. Thanks Could be mistaken but am guessing that "button" performs an action/function for vMix so am wondering why not do this strait from the script ? Btw have you searched the forum for Http request or google for vb.net Httprequest Button presses, and other stuff, in Companion can do many things that cannot be done in vMix. I think (doggy might correct me on this) that generally TCP would be a more efficient method than HTTP requests. So that is what I am using. I posted an example in https://forums.vmix.com/...-for-Dummies#post114636. Please feel free to modify it for Button presses. Cheers!
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 5/16/2021(UTC) Posts: 8 Thanks: 1 times
|
Thank you for your help. I did need to press a button in Companion to control an ATEM. This worked well when I modified it for a button press which is my immediate need, but I could not get a custom variable to change. Do you see anything I could be doing wrong. I commented out the loop to simplify it even further. The variable exists as I copied its name.
Thanks again for your help and posting that simple bit of code is super helpful.
' Prepare for TCP Dim tcpCompanionIP as string = "127.0.0.1" Dim tcpCompanionPort as integer = "16759" Dim client As New System.Net.Sockets.TcpClient(tcpCompanionIP, tcpCompanionPort) Dim stream As System.Net.Sockets.NetworkStream = client.GetStream()
' Define variables Dim content As String = "Test_TCP" Dim numberOfTimes as Integer = 4
' Loop a number of times ' For aNumber as Integer = 1 to numberOfTimes Dim customVariableName As String = "$(internal:Cam_Transition) " Dim companionCommand as String = "CUSTOM-VARIABLE " & customVariableName & " SET-VALUE " & content Dim data As [Byte]() = System.Text.Encoding.ASCII.GetBytes(companionCommand & Environment.NewLine) stream.Write(data, 0, data.Length) ' Next
' Close TCP stream.Close() client.Close()
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 2/18/2014(UTC) Posts: 1,838 Location: Stockholm
Thanks: 144 times Was thanked: 297 time(s) in 250 post(s)
|
try instead with Dim customVariableName As String = "Cam_Transition"
/richard
|
1 user thanked richardgatarski for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 5/16/2021(UTC) Posts: 8 Thanks: 1 times
|
Thats what I needed thank you.
|
|
|
|
vMix Forums
»
General
»
General Discussion
»
Sending http requests to Companion 3.x in script
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close