logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Mollertom  
#1 Posted : Friday, June 28, 2024 2:23:41 AM(UTC)
Mollertom

Rank: Newbie

Groups: Registered
Joined: 5/16/2021(UTC)
Posts: 8
Canada

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
doggy  
#2 Posted : Friday, June 28, 2024 3:39:00 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,243
Belgium
Location: Belgium

Thanks: 294 times
Was thanked: 960 time(s) in 794 post(s)
Originally Posted by: Mollertom Go to Quoted Post
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
richardgatarski  
#3 Posted : Friday, June 28, 2024 8:45:38 AM(UTC)
richardgatarski

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 Go to Quoted Post
Originally Posted by: Mollertom Go to Quoted Post
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!
Mollertom  
#4 Posted : Friday, June 28, 2024 9:23:23 PM(UTC)
Mollertom

Rank: Newbie

Groups: Registered
Joined: 5/16/2021(UTC)
Posts: 8
Canada

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()
richardgatarski  
#5 Posted : Saturday, June 29, 2024 6:05:35 AM(UTC)
richardgatarski

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
thanks 1 user thanked richardgatarski for this useful post.
Mollertom on 6/30/2024(UTC)
Mollertom  
#6 Posted : Sunday, June 30, 2024 10:08:40 AM(UTC)
Mollertom

Rank: Newbie

Groups: Registered
Joined: 5/16/2021(UTC)
Posts: 8
Canada

Thanks: 1 times
Thats what I needed thank you.
Users browsing this topic
Guest (3)
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.