Rank: Advanced Member
Groups: Registered
Joined: 5/15/2020(UTC) Posts: 33 Thanks: 1 times
|
Thanks so much!!!! Now it is working. I used this code: Code:dim x as integer=255
for i as integer = 0 to 255
API.Function("SetAlpha",Input:=2,Value:=x)
x=x-1
sleep(4)
next
Just for anyone that needs a script that fades in/out an input.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,237 Location: Belgium Thanks: 293 times Was thanked: 958 time(s) in 793 post(s)
|
Try ;-) Code:for i as integer = 255 to 0 step -1
console.writeline(i.tostring)
next
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,237 Location: Belgium Thanks: 293 times Was thanked: 958 time(s) in 793 post(s)
|
MIX inputs <> regular input controlCode:' TheInput is the name of the input within quotes, its number without quotes or a variable holding that name or number
' Mix related
' place TheInput in the Mix2 Preview
API.Function("PreviewInput",Input:= TheInput,Mix:=1)
' place TheInput in the Mix2 Output
API.Function("ActiveInput",Input:= TheInput,Mix:=1)
' Do a transition in Mix2
API.Function("Fly",Input:=0,Mix:=1)
' General
' Put an input in the preview
API.Function("PreviewInput",Input:=TheInput)
' Put an input in the Output
API.Function("ActiveInput",Input:=TheInput)
' Transition the preview to output
API.Function("Slide",Input:=0)
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 5/27/2017(UTC) Posts: 93 Location: Greater St Louis Area Thanks: 67 times Was thanked: 20 time(s) in 13 post(s)
|
I had an issue where I needed to convert for the API XML Volume attribute of an input to the Mixer Fader Volume for that input. The two Volume values are not the same thing, so some work was required to get between them: Code:dim x as new system.xml.xmldocument ' Create the XML document to parse
x.loadxml(API.XML()) ' Load the API into the XML document. For a visual, see http://127.0.0.1:8088/api
' Get the current Volume attribute value from the input (input 1 in this case)
dim xmlVolume As Double = x.SelectSingleNode("//input[@number='1']/@volume").Value
xmlVolume = xmlVolume / 100' I think this is actually Amplitude, not Volume. Amplitude is expected to be a normalized (0-1) value in the formula, which is not how the XML treats it
dim faderVolume As Integer = cint((xmlVolume ^ 0.25) * 100) ' Formula: Volume = (Amplitude ^ 0.25) * 100
The formula came from: https://www.vmix.com/knowledgebase/article.aspx/144/vmix-api-audio-levelsI hope this helps! Chad
|
3 users thanked clafarge for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,237 Location: Belgium Thanks: 293 times Was thanked: 958 time(s) in 793 post(s)
|
Its sometimes a bit confusing /tricky to find the proper xpath for getting specific data from an XML file be it for within a script or in the XML datasource manager A few helpful links that can generate an xpath for you. Mind you one might have to tweak the results a bit depending if one uses it for within a script or a datasource Manager http://xmltoolbox.appspot.com/xpath_generator.html (will give a result based on a selection) https://www.easycodeforall.com/XPathUtility.jsp (will give a whole list of potential xpaths, has a few more goodies as well)
|
5 users thanked doggy for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/30/2020(UTC) Posts: 2
|
Hey All. Long time listener, first time caller.
Before I go too far down the rabbit hole, I just wanted to check if this was even possible.
Can a script change the audio assignment to an output?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 3/20/2014(UTC) Posts: 2,721 Location: Bordeaux, France Thanks: 243 times Was thanked: 794 time(s) in 589 post(s)
|
Quote:Can a script change the audio assignment to an output? Scripts can do anything there is an API command for
|
2 users thanked DWAM for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/15/2020(UTC) Posts: 7 Thanks: 1 times Was thanked: 1 time(s) in 1 post(s)
|
Is there a way to get the production clock event start time and the countdown from it?
I'm trying to write a script that will look at the length of a pre-show video and calculate the time to start the video so that the video ends at the event start time. The length changes every show so it isn't consistent. I have everything working but right now I have to manually edit the script and put in my start time which is not a big deal for me. However, I'm trying to make this as easy as possible for other operators and using the production clock would be ideal. If someone could supply what the code would be of getting the start time that would be great (countdown would be useful for other uses).
Thank you for the support, I've learned a lot just by reading this thread and hacking together multiple scripts to fit my needs.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,237 Location: Belgium Thanks: 293 times Was thanked: 958 time(s) in 793 post(s)
|
Originally Posted by: Pyrrhus Is there a way to get the production clock event start time and the countdown from it?
What about using a title's "countdown to time"
|
1 user thanked doggy for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/15/2020(UTC) Posts: 7 Thanks: 1 times Was thanked: 1 time(s) in 1 post(s)
|
***SEE EDIT BELOW***Originally Posted by: doggy Originally Posted by: Pyrrhus Is there a way to get the production clock event start time and the countdown from it?
What about using a title's "countdown to time" I feel dumb, Of course just setup a title with the time I want. I also didn't know there was a countdown to time. I think i'm missing something in the syntax though. So If I create a title with the input called TimetoStart with "08:00:00" as the text would I put this to store the value? Code:dim content as string = Input.Find("TimetoStart").Text("TextBlockName.Text")
When I do console.writeline(content) nothing is displayed in the console. Btw doggy, thanks for all the stuff you've posted. I've been copying and modifying a lot of your stuff for my own needs. ****EDIT****
I figured it out, I see that in the title editor it gives you the name of the field. In my case it's called Title so this would be my code. Hopefully if someone else gets stuck they can see this. Code:dim content as string = Input.Find("TextHD.xaml").Text("Title")
|
1 user thanked Pyrrhus for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,237 Location: Belgium Thanks: 293 times Was thanked: 958 time(s) in 793 post(s)
|
Totaling values from multiple GT Titles textboxesCode:Dim one as integer = Convert.toInt32(Input.Find("Tally.gtzip").Text("One.Text"))
Dim Two as integer = Convert.toInt32(Input.Find("Tally.gtzip").Text("Two.Text"))
API.Function("SetText",Input:="Tally.gtzip",SelectedName:="Total.Text",Value:=(One + Two).tostring)
|
1 user thanked doggy for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 4/16/2017(UTC) Posts: 578 Location: jamaica
Thanks: 77 times Was thanked: 32 time(s) in 31 post(s)
|
I am glad to find this post...as a real dummy to scripting, I am looking for help......
I have a scoreboard with different players, and I have the scores of each player advancing correctly....What I want is a script to total these scores in real time to show the total for that team as the players scores advances....I just don't have a clue of what to do.....(e.g. Player A:=20, Player B:=10 Total Score: =30, and advances as the score for each player changes...)
thanks in advance.....
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,237 Location: Belgium Thanks: 293 times Was thanked: 958 time(s) in 793 post(s)
|
Originally Posted by: Joeboe I am glad to find this post...as a real dummy to scripting, I am looking for help......
I have a scoreboard with different players, and I have the scores of each player advancing correctly....What I want is a script to total these scores in real time to show the total for that team as the players scores advances....I just don't have a clue of what to do.....(e.g. Player A:=20, Player B:=10 Total Score: =30, and advances as the score for each player changes...)
thanks in advance..... You're glad but you didn't read any of it ! Maybe check the post just before yours !
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 4/16/2017(UTC) Posts: 578 Location: jamaica
Thanks: 77 times Was thanked: 32 time(s) in 31 post(s)
|
I saw that after I posted...was pointed to it on the facebook post....but now I can not get the scores to work.....
I am getting issues adding the code....I tried adding the scrip to vMix but keep getting an error ( Error Line 4: BC30451: Name 'TEAM' is not declared...I tried changing things but nothing is happening...the error is still there, and sometimes it changer to different errors
The word 'TEAM' is part of the name for the area where I want the Total to be....I labeled it as TEAM SCORE, but I get an error
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,237 Location: Belgium Thanks: 293 times Was thanked: 958 time(s) in 793 post(s)
|
Originally Posted by: Joeboe I saw that after I posted...was pointed to it on the facebook post....but now I can not get the scores to work.....
I am getting issues adding the code....I tried adding the scrip to vMix but keep getting an error ( Error Line 4: BC30451: Name 'TEAM' is not declared...I tried changing things but nothing is happening...the error is still there, and sometimes it changer to different errors
The word 'TEAM' is part of the name for the area where I want the Total to be....I labeled it as TEAM SCORE, but I get an error is what happens when you don't follow instructions even after been given working title template and script. Case closed for those interested https://www.dropbox.com/...4c1/Crickettest.zip?dl=0Added:
|
2 users thanked doggy for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,237 Location: Belgium Thanks: 293 times Was thanked: 958 time(s) in 793 post(s)
|
Writing a timestamps to file for a recording (triggered by shortcut) Credit to Elgarf ( https://forums.vmix.com/...-Marker-Hotkey#post81271 ) Code:'Text file for time marks
dim FILENAME = "D:\out.txt"
'Get recording duration
dim xml = API.XML()
dim x as new system.xml.xmldocument
x.loadxml(xml)
dim Duration = integer.parse((x.SelectSingleNode("//recording/@duration").Value))
dim Second = math.floor(Duration mod 60)
dim Minute = math.floor((Duration / 60) mod 60)
dim Hour = math.floor((Duration / (60 * 60)) mod 60)
'Write recording duration to file
System.IO.File.AppendAllText(filename, string.format("{0:00}:{1:00}:{2:00}"&Environment.NewLine, Hour, Minute, Second))
|
1 user thanked doggy for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/9/2020(UTC) Posts: 156
Thanks: 3 times Was thanked: 20 time(s) in 19 post(s)
|
is it possible via API to change virtual PTZ speed ? in shortcuts it shows options for direction, zoom and start/stop but nothing to control speed.. im wondering if there is some other way of accessing speed control via scripts though ?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,237 Location: Belgium Thanks: 293 times Was thanked: 958 time(s) in 793 post(s)
|
Originally Posted by: mtone is it possible via API to change virtual PTZ speed ? in shortcuts it shows options for direction, zoom and start/stop but nothing to control speed.. im wondering if there is some other way of accessing speed control via scripts though ? ptzspeed.JPG (53kb) downloaded 9 time(s).
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/9/2020(UTC) Posts: 156
Thanks: 3 times Was thanked: 20 time(s) in 19 post(s)
|
i did see that setting but is there a way for this to be controlled via a script that dynamically changes the speed of the virtual PTZ ? for example... i want to move the joystick right and instead of it moving at 100% speed right away i want it to ramp up the speed from 0-100% over a short period of time (around 1 second).. then when i let go of the joystick id like it to ease back down slowly to a stop.. same with zoom in and out, id like to ease in and out of the desired speeds instead of being at maximum immediately when you move the controller.
is this possible with scripting somehow ? Im a novice in that department, but if this example is possible id like to try and work it out..
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,237 Location: Belgium Thanks: 293 times Was thanked: 958 time(s) in 793 post(s)
|
Originally Posted by: mtone i did see that setting but is there a way for this to be controlled via a script that dynamically changes the speed of the virtual PTZ ? for example... i want to move the joystick right and instead of it moving at 100% speed right away i want it to ramp up the speed from 0-100% over a short period of time (around 1 second).. then when i let go of the joystick id like it to ease back down slowly to a stop.. same with zoom in and out, id like to ease in and out of the desired speeds instead of being at maximum immediately when you move the controller.
is this possible with scripting somehow ? Im a novice in that department, but if this example is possible id like to try and work it out.. Let us know how it works out Do some research on how that works with hardware
|
|
|
|
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