vMix Forums
»
General
»
3rd Party Software and Development
»
Scripting in vMix: Change Text Field properties
Rank: Advanced Member
Groups: Registered
Joined: 8/5/2013(UTC) Posts: 280 Location: Poland Thanks: 29 times Was thanked: 40 time(s) in 37 post(s)
|
Hi,
Is (and if so - how?) it possible to change properties of Titles.xaml's Text Field with VB.NET Scripting?
By properties I mean things like: Margin, Height, Width, FontSize, Color etc...
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/5/2013(UTC) Posts: 280 Location: Poland Thanks: 29 times Was thanked: 40 time(s) in 37 post(s)
|
My question is quite general, but here is what I would like to achieve.
It's about basketball game, where we have quarters. I have a scoreboard that shows the result: After (or during) 2nd quarter: 1st, 2nd and total score After (or during) 3rd quarter: 1st, 2nd, 3rd and total score etc. (with up to 2 overtimes)
I did a script that increments score fields each quarter and updates total score too.
1st quarter score and 2nd quarter score fields are always at the same place. But when we add 3rd quarter score, the total score moves right. Then, when we add 4th quarter score the total score moves again.
The total score is represented with total_home_score and total_away_score fields. I'd like to change their margins when the quarter is changed to 3, 4, OT1 or OT2.
* * * I did a workaround, creating multiple total_score fields (each quarter..), but it's not neat. * * * Anyway, scripting tool is awesome. And it's an opinion of someone who is not a programmer.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 3/7/2012(UTC) Posts: 2,636 Location: Canada Thanks: 33 times Was thanked: 506 time(s) in 475 post(s)
|
@ r@wisla
Can you provide visual examples of your issue?
Ice
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/5/2013(UTC) Posts: 280 Location: Poland Thanks: 29 times Was thanked: 40 time(s) in 37 post(s)
|
IceStream wrote:Can you provide visual examples of your issue? Here it is. I described one solution - switching to next quarter: - change background image - move total_score_home and total_score_away right (= change margin of total_score_home and total_score_away) Second solution: no total_score fields, but fields:score_row1_col1 score_row1_col2 score_row1_col3 score_row1_col4 (...) score_row2_col1 (...) score_row2_col6 score_row2_col7 When quarter 2:score_row1_col1 = score of home team in quarter one score_row1_col2 = score of home team in quarter two score_row1_col3 = total score of home team - font color black(!) score_row2_col1 = score of away team in quarter one score_row2_col2 = score of away team in quarter two score_row2_col3 = total score of away team - font color black(!) fields with col4 to 7 - set to empty (not 0!) When quarter 3:change background image score_row1_col3 = score of home team in quarter three - font color changed to white(!) score_row1_col4 = total score of home team - font color black(!) score_row2_col3 = score of away team in quarter three - font color changed to white(!) score_row2_col4 = total score of away team - font color black The third solution was to make white and black fields at the same position and that is what I applied. But the script is long, the xaml file is unnecessarily big... It just would be wiser to change the total_score fields position (solution one) or change fields color (solution two). r@wisla attached the following image(s): stats-by-quarter-sample.png (333kb) downloaded 1,196 time(s).You cannot view/download attachments. Try to login or register.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/5/2013(UTC) Posts: 280 Location: Poland Thanks: 29 times Was thanked: 40 time(s) in 37 post(s)
|
Back to the first question? Is changing Title properties with .NET scripting is possible?
There are text properties that can be edited by vMix (like font, font size and color) and some that cannot (margin, height, width...). But non of them I was able to change with .NET so far.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 10/23/2015(UTC) Posts: 458 Thanks: 20 times Was thanked: 227 time(s) in 129 post(s)
|
Hi. You can use triggers to switch between quarters. If you don't want to animate it, it will be simply.
As I understood, you have an image for each quarter?
I'll try to make an example, but later.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/5/2013(UTC) Posts: 280 Location: Poland Thanks: 29 times Was thanked: 40 time(s) in 37 post(s)
|
Actually, I did the script. What it does is:
I have keys [Home +1] [Home +2] [Home +3] [Away +1] [Away +2] [Away +3]
When I press the key it: - checks what quarter is now (if quarter field is "1st" or "2nd" or...) - adds 1, 2 or 3 points to home or away quarter score - adds 1, 2 or 3 points to home or away game score
When I switch to next quarter the script changes the background, adds next quarter score fields (actually it changes them from empty to 0) etc...
But an option to change text field properties with .NET would make my script shorter, less complicated and faster.
I think, a possibility to change text field margin with scripting could be usefull for other things. Like football (soccer) squad field presentation - different formations.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 10/23/2015(UTC) Posts: 458 Thanks: 20 times Was thanked: 227 time(s) in 129 post(s)
|
You can set x:Name property of your text fields, and change any properties that you want. Can't you?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/5/2013(UTC) Posts: 280 Location: Poland Thanks: 29 times Was thanked: 40 time(s) in 37 post(s)
|
How? I have a text field like Quote: <mtl:TextBlockDesign FontFamily="Univers Condensed Bold" Fill="#FFFFFFFF" FontSize="23" TextAlignment="Center" Text="" Name="txt_score_home4" Width="40" Height="28" Margin="834,589,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Visible" InputMethod.IsInputMethodEnabled="True" />
How can I change the Fill, Margin etc with script? What's the syntax?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 10/23/2015(UTC) Posts: 458 Thanks: 20 times Was thanked: 227 time(s) in 129 post(s)
|
Something like that
txt_score_home4.Fill = new SolidColorBrush(Colors.Red); txt_score_home4.Margin = new Thickness(100, 200, 1, 50);
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/5/2013(UTC) Posts: 280 Location: Poland Thanks: 29 times Was thanked: 40 time(s) in 37 post(s)
|
What language is this? C#? Did you try it with vMix scripting? It's different from what I tried (based on vMix help - http://www.vmix.com/help....htm?VBNetScripting.html ) My code is like: Code:
dim j = Input.Find("stats-by-quarter.xaml")
dim i = Input.Find("Scoreboard.xaml")
i.Text("kwarta") = "4th"
j.Text("txt_score_home4") = 0
dim sh1 as Integer = j.Text("txt_score_home1")
dim sh2 as Integer = j.Text("txt_score_home2")
dim sh3 as Integer = j.Text("txt_score_home3")
j.Text("txt_score_home_totalx4") = sh1+sh2+sh3
API.Function("SetImage", "stats-by-quarter.xaml", "STATS-BY-QUARTER-x4.png", 100, "img_background")
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/13/2010(UTC) Posts: 5,207 Location: Gold Coast, Australia Was thanked: 4285 time(s) in 1519 post(s)
|
At the moment only text and image properties can be changed in the API and in Scripting. This may be expanded in future releases.
|
1 user thanked admin for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/5/2013(UTC) Posts: 280 Location: Poland Thanks: 29 times Was thanked: 40 time(s) in 37 post(s)
|
admin wrote:At the moment only text and image properties can be changed in the API and in Scripting. This may be expanded in future releases. Is this still not possible? I just have to implement new graphics to vMix. The scorebug behaviour is: when the team scores its name changes to white. I think I have a workaround but API/script command to change text color would make it much simple.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 5/20/2015(UTC) Posts: 493 Location: Copenhagen, Denmark Thanks: 389 times Was thanked: 100 time(s) in 79 post(s)
|
r@wisla wrote: I just have to implement new graphics to vMix. The scorebug behaviour is: when the team scores its name changes to white.
I think I have a workaround but API/script command to change text color would make it much simple.
In a graphic title (XAML file), you can make variables, that can be used to set colors. This way you can make an API call to change the value of the variable, in the same way you normally change the text in a title. I've made a demo with a title where the background of the title changes.
|
2 users thanked stigaard for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/5/2013(UTC) Posts: 280 Location: Poland Thanks: 29 times Was thanked: 40 time(s) in 37 post(s)
|
Thanks stigaard, great idea, better then mine.
Could You help me, how to make that - text color field corresponds with - the Fill attribute of my Teamname text field?
* * * Update * * * OK, I see You used vMix Free Lower Third Pack published on shop.njastad.com and found how to do it.
Thanks
|
|
|
|
vMix Forums
»
General
»
3rd Party Software and Development
»
Scripting in vMix: Change Text Field properties
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