Knowledge Base

Home»Knowledge Base»Scripting / API»Scripting Example: Add last recording to vMix as an input
« Back to Knowledge Base

Scripting Example: Add last recording to vMix as an input

The following sample code uses the vMix Scripting feature in vMix 4K and Pro editions.
The code defaults to finding the latest MP4 recording in the default recording folder (Documents\vMixStorage)
        Dim szExt As String = ".mp4"
        Dim szFolder As String = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) & "\vmixstorage"
        Dim szLatestFile As String = ""
        Dim dLatestFile As Date = Nothing
        For Each szFile As String In System.IO.Directory.GetFiles(szFolder)
            Dim fi As New System.IO.FileInfo(szFile)
            If fi.Extension = szExt Then
                If fi.LastWriteTime > dLatestFile Then
                    szLatestFile = szFile
                    dLatestFile = fi.LastWriteTime
                End If
            End If
        If System.IO.File.Exists(szLatestFile) Then
            API.Function("AddInput", Value:="Video|" & szLatestFile)
        End If

Last Updated: Friday, 29 September 2017 9:58:25 AM