Elvir Surkovic
Forum Replies Created
-
I have sent email to andi.nakasone@gmail.com with attached tool. Please, check your inbox.
You can reach me at: e.surkovic@ieee.org -
Hi Andi,
I did not test the code with Vegas ver 9.0, but it should work as well as with older version. I will test the code and let you know about the results. -
hi angela,
You should really have no problems with finding the file through Vegas window.
One of the reasons could be that(in Windows Explorer) Tools->Folder Options->View->Hide Extensions for known files is checked. If it is the case, you cannot see the default extension of txt file.
Go to (Using Windows Explorer):C:\Program Files\Sony\Vegas Pro 8.0\Script Menu. In that folder you should see some script files with extension .js and .cs. If you cannot see that extension, it means that you have to make that option unchecked.
Also, try to put the file you created in this folder, you should see it in the Tools->Scripting menu. If Vegas is already open, Run Tools->Scripting->Rescan Script Menu Folder, to make it know about your file.
I hope this will help you.
-
I had to solve the same problem for my company. The problem is in the EDL file generated by Vegas, which does not fit FCP EDL file expected.
So I developed vb script to correct the EDL file generated by Vegas to fit expected FCP EDL format.
First, export edl as you did, then start this script to make necessary corrections (Tools->Scripting->Run Script).Save this script text to text file, which must have an .vb extension:
———————————————Script Start———————————————-
Imports System.Windows.Forms Imports System Imports Sony.Vegas Imports System.IO Imports System.Array Public Module MainModule Sub Main Const fileTag As String = "_BHRT.EDL" 'Change original EDL filename to indicate sucessfull script operation Dim openFileDialog1 As New OpenFileDialog() Dim inFile As String Dim outFile As String openFileDialog1.InitialDirectory = "c:\" openFileDialog1.Filter = "edl files (*.edl)|*.edl" openFileDialog1.FilterIndex = 2 openFileDialog1.RestoreDirectory = True 'MessageBox.Show("hello world") 'openFileDialog1.ShowDialog() If openFileDialog1.ShowDialog() = DialogResult.OK Then inFile = openFileDialog1.FileName If Not (inFile Is Nothing) Then ' Insert code to read the stream here. outFile = inFile.Remove(inFile.Length - 4) + fileTag Dim files As FileClass = New FileClass(inFile, outFile, "") files.pullLines() files.pullClips() files.closeFiles() My.Computer.FileSystem.DeleteFile(inFile) End If Else Application.Exit() End If End Sub Public Class FileClass Const EDL_Identifier As String = "* FROM CLIP NAME:" 'Do not change this constant Const EDL_IdentifierCorrection As String = " " 'Do not change this constant Const EDL_FilesExtension As String = ".MOV" 'Change this constant to your video files extension (.avi,...) Const EDL_ReelOld As String = "UNKNOWN" 'Do not change this constant Const EDL_ReelPrefix As String = "FC" 'Prefix to reel names in EDL list (You can change this constant as you wish) Private f1Stream As FileStream ' file: originalni EDL Private f1Reader As StreamReader ' Private f1Name As String Private f2Stream As FileStream ' file: novi EDL Private f2Reader As StreamWriter ' Private f2Name As String Private f3Stream As FileStream ' file: log Private f3Reader As StreamWriter ' Private f3Name As String Private linesListArr As String() Private linesList_TagArr As String() Private linesIndex As Integer = 0 Private linesEnd As Boolean = False Private clipsTmpArr As String() Private clipsListArr As String() Private linesEDLArr As String() Public Sub New(ByVal p1FileName As String, ByVal p2FileName As String, ByVal p3FileName As String) f1Name = p1FileName f2Name = p2FileName f3Name = p3FileName Try If (p1FileName IsNot Nothing) And (p1FileName <> "") Then f1Stream = New FileStream(f1Name, FileMode.Open, FileAccess.Read) f1Reader = New StreamReader(f1Stream) End If If (p2FileName IsNot Nothing) And (p2FileName <> "") Then f2Stream = New FileStream(f2Name, FileMode.OpenOrCreate, FileAccess.Write) f2Reader = New StreamWriter(f2Stream) End If If (p3FileName IsNot Nothing) And (p3FileName <> "") Then f3Stream = New FileStream(f3Name, FileMode.OpenOrCreate, FileAccess.Write) f3Reader = New StreamWriter(f3Stream) End If Catch ex As Exception MsgBox("File does not exist", MsgBoxStyle.Critical, "Sony Vegas Script") End Try End Sub Public Sub closeFiles() f1Reader.Close() f1Stream.Close() f2Reader.Close() f2Stream.Close() 'f3Reader.Close() 'f3Stream.Close() End Sub Public Sub pullLines() Dim index As Integer = 0 ReDim Preserve linesListArr(2000) Do Until f1Reader.EndOfStream linesListArr(index) = f1Reader.ReadLine() index = index + 1 Loop ReDim Preserve linesListArr(index - 1) ReDim Preserve linesList_TagArr(index - 1) ReDim Preserve linesEDLArr(index - 1) End Sub Public Sub pullClips() Dim i As Integer Dim j As Integer = 0 Dim sPom As String = "" ReDim Preserve clipsListArr(0) ReDim clipsTmpArr(linesListArr.Length - 1) For i = 0 To linesListArr.Length - 1 If linesListArr(i).Length > 17 Then sPom = linesListArr(i).Substring(0, 17) End If linesList_TagArr(i) = "" If sPom = EDL_Identifier Then clipsTmpArr(j) = linesListArr(i).Substring(18, linesListArr(i).Length - 18) linesList_TagArr(i) = clipsTmpArr(j) j = j + 1 End If Next ReDim Preserve clipsTmpArr(j - 1) Array.Sort(clipsTmpArr) ReDim Preserve clipsListArr(j - 1) j = 0 clipsListArr(0) = clipsTmpArr(0) For i = 0 To clipsTmpArr.Length - 1 If clipsListArr(j) <> clipsTmpArr(i) Then j = j + 1 clipsListArr(j) = clipsTmpArr(i) End If Next ReDim Preserve clipsListArr(j) createLines_EDL() For i = 0 To linesEDLArr.Length - 1 insLine_EDL(linesEDLArr(i)) Next End Sub Public Sub createLines_EDL() Dim i As Integer linesEDLArr(0) = linesListArr(0) linesEDLArr(1) = linesListArr(1) For i = 2 To linesListArr.Length - 2 Step 2 linesEDLArr(i) = linesListArr(i) linesEDLArr(i) = linesListArr(i).Replace(EDL_ReelOld, EDL_ReelPrefix + findReel(i + 1)) Next For i = 3 To linesListArr.Length - 1 Step 2 linesEDLArr(i) = EDL_Identifier + EDL_IdentifierCorrection + linesList_TagArr(i) + EDL_FilesExtension Next End Sub Private Function findReel(ByVal index As Integer) As String Dim i As Integer For i = 0 To clipsListArr.Length - 1 If linesList_TagArr(index) = clipsListArr(i) Then Return (i + 1).ToString End If Next Return "" End Function Public Sub insLine_EDL(ByVal line As String) Dim txtLine As String txtLine = line f2Reader.WriteLine(txtLine) End Sub Public Sub insLine_comment(ByVal comment As String) Dim txtLine As String txtLine = comment f3Reader.WriteLine(txtLine) End Sub Public Sub resetIndex() linesIndex = 0 End Sub Public ReadOnly Property ProductsList() As String() Get Return linesListArr End Get End Property Public ReadOnly Property ProductsListIndex() As Integer Get Return linesIndex End Get End Property Public ReadOnly Property ProductsListEnd() As Boolean Get Return linesEnd End Get End Property End Class End Module———————————————Script End————————————————