logo

Live Production Software Forums


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

Notification

Icon
Error

18 Pages«<161718
Options
Go to last post Go to first unread
doggy  
#341 Posted : Monday, January 23, 2023 8:14:57 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 4,403
Belgium
Location: Belgium

Thanks: 249 times
Was thanked: 793 time(s) in 646 post(s)
Originally Posted by: Black Dog Go to Quoted Post
Thanks, Salvatore!
All layers turn On. Then "OFF" as "Set_Layer_NONE" and "ON" as Set_Layer_SomeInput. That is good idea.
Well, I need to rewrite all the scripts (((( with new idea.

Sorry, in code - Input_number as Numder or Input_name as Title. Somebody can copy code and VB_Try hides typing error )))
Originally Posted by: Salvatore Go to Quoted Post

Code:

Input1Layer1on = (x.SelectSingleNode("//input[@number='"& Input1name &"']/overlay[@index='0']/@key").value)


Is because the script is not complete, for one it doesnt defines the XML file and its access . but there are examples for that in this forum thread
Salvatore  
#342 Posted : Tuesday, January 24, 2023 11:37:15 PM(UTC)
Salvatore

Rank: Advanced Member

Groups: Registered
Joined: 11/15/2021(UTC)
Posts: 40
Italy

Thanks: 2 times
Was thanked: 5 time(s) in 4 post(s)
Originally Posted by: Black Dog Go to Quoted Post
Thanks, Salvatore!
All layers turn On. Then "OFF" as "Set_Layer_NONE" and "ON" as Set_Layer_SomeInput. That is good idea.
Well, I need to rewrite all the scripts (((( with new idea.

Sorry, in code - Input_number as Numder or Input_name as Title. Somebody can copy code and VB_Try hides typing error )))
Originally Posted by: Salvatore Go to Quoted Post

Code:

Input1Layer1on = (x.SelectSingleNode("//input[@number='"& Input1name &"']/overlay[@index='0']/@key").value)



if you search by title you have to declare it first:

Code:
'script will search the Input with Title "Input1name" and check the Input Number
dim Input1name as string = (x.SelectSingleNode("//input[@title='Input1name']/@number").Value)



Or instead of
Input1Layer1on = (x.SelectSingleNode("//input[@number='"& Input1name &"']/overlay[@index='0']/@key").value)
You can search directly by Input number:
Input1Layer1on = (x.SelectSingleNode("//input[@number='1']/overlay[@index='0']/@key").value)


And note that the Layer Numbers are different to the Index Numbers, because the Layers beginns to count from 1 and the Index beginns to count from 0
Input3Layer4on = (x.SelectSingleNode("//input[@number='3']/overlay[@index='3']/@key").value)
Input3Layer5on = (x.SelectSingleNode("//input[@number='3']/overlay[@index='4']/@key").value)
Input3Layer6on = (x.SelectSingleNode("//input[@number='3']/overlay[@index='5']/@key").value)
Ario  
#343 Posted : Friday, January 27, 2023 6:38:36 AM(UTC)
Ario

Rank: Advanced Member

Groups: Registered
Joined: 2/2/2015(UTC)
Posts: 154
Location: NL

Thanks: 151 times
Was thanked: 17 time(s) in 14 post(s)
Sharing a vMix script a friend wrote.
The use case:
The List input of vMix, strangely and unfortunately enough, only sorts its file order by file name, and A-Z only (no option for Z-A etc.).
We need files in the list to be sorted Z-A, specifically:
time + date are in the filename and we need to play the newest / latest file (highest date, highest time) first.
Why? Because these are exports from vMix replay (with filename: date - text - time), and we play these back during breaks in the game.
We want to be certain that during these breaks, viewers see the most recent actions as replays. Starting with the most recent one and then going back in time, step by step, ensures this.
Playback of replay events in chronologically reversed order, so to say.

We use Elgato StreamDecks with Companion.
There is a button that first creates the replay event, with a second action on that same button to export the event as an .avi file.

There must be an list input in your vMix project that is called List.

Every time the script is called (we have it behind a keyboard shortcut),
it clears the existing files from the list, populates the list with all avi-files in the specified folder,
sorts these by date/time descending (date/time are taken from file NAME),
and transitions that list (in our case, the list is on input 94) to PGM Out, using Stinger2.

The list has "Auto Next" on.
The list input (94) has a Trigger on it:
OnCompletion - Stinger2 - 1.Main
which means that when the entire list has played, Stinger2 transitions input 1 (Main camera) into PGM Out,
effectively moving the list into Preview.
The longer the list grows, the greater the chance our director transitions out of it manually, before it has completely played.

<start of the script>

Code:
'Script to sort the files on a part of the filename,
'instead of filename itself
'This script sorts files on the relevant time part in the filename
'e.g. "20221210 - Camera4 - [21-32-10] [21-32-15].avi"

Dim relevant_character as string = "["
Dim unique_separator as string = "|"

Dim p As String = "D:\vMix-IRP_D\replays\"
Dim di As New system.IO.DirectoryInfo(p)

Dim fa as system.io.fileinfo() = di.getfiles("*.avi")
dim fi as system.io.fileinfo

Dim cnt as integer = fa.Length
Dim sa(cnt) As String
Dim i as integer = 0
Dim x() as String

for each fi in fa
    'split the filename on the relevant part to sort on;
    'substring can also be used of course
    x = fi.Name.Split(relevant_character)
    sa(i) = x(1) & unique_separator & fi.FullName
    'Console.WriteLine(Cstr(i)&"."&sa(i))
    i += 1
Next

Array.Sort(sa)
Array.Reverse(sa)
API.Function("ListRemoveAll","List")

'Console.WriteLine("----")

i = 0
dim s as String
dim f as String
for each s in sa
    'for some reason, does the sorted array have an extra empty element?
    if s = Nothing
        Continue For
    end if

    'split the value on the unique_separator to get the original filename
    x = s.Split(unique_separator)
    'Console.WriteLine(Cstr(i)&"."&x(1))
    API.Function("ListAdd","List",x(1)) 
    i += 1  

Next

API.Function("Stinger2", Input:="94")

<end of the script>

Please feel free to use, modify, improve, elaborate, comment.
doggy  
#344 Posted : Friday, January 27, 2023 6:49:28 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 4,403
Belgium
Location: Belgium

Thanks: 249 times
Was thanked: 793 time(s) in 646 post(s)
Originally Posted by: Ario Go to Quoted Post
Sharing a vMix script a friend wrote.
The use case:


Please enclose the code in language Syntax Highlighting for clarity and readability
thanks 1 user thanked doggy for this useful post.
Ario on 1/27/2023(UTC)
Users browsing this topic
18 Pages«<161718
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.