Sub TCExtractor() 'This script extracts the start timecode of a WAV file _ using Exiftool from Phil Harvey: _ https://www.sno.phy.queensu.ca/~phil/exiftool/ 'Please make sure you have Exiftool installed before using it Dim File As String 'taken from dialog box Dim HDD As String 'taken from dialog box Dim FileInfoStr As String 'extracted with exiftool Dim FileInfoArr As Variant 'currently unused Dim FrameRate As Double Dim SampleRateStr As String 'taken from file Dim TimeRefStr As String 'taken from file Dim FramesLng As Long 'calculated Dim TimeCodeLng As Long 'calculated Dim Script As String 'get file File = Application.GetOpenFilename 'get root drive to remove from string HDD = Split(File, ":")(0) 'remove root drive from string File = Replace(File, HDD, "") 'format path for shell script File = Replace(File, ":", "/") 'put script in string Script = "do shell script " & Chr(34) & "/usr/local/bin/exiftool " & Chr(34) & "& quoted form of " & Chr(34) 'get frame rate FrameRate = 25 'Frame Rate Can be found under description & sSpeed _ but it might vary depending on application :( 'get metadata using exiftool FileInfoStr = MacScript(Script & File & Chr(34)) 'the following is a way of getting an array from the exiftool info: 'FileInfoArr = Split(FileInfoStr, Chr(13)) 'get sample rate from metadata SampleRateStr = Mid(Join(Filter(Split(FileInfoStr, Chr(13)), "Sample Rate"), "*"), 35) 'get timecode (in samples) from metadata TimeRefStr = Mid(Join(Filter(Split(FileInfoStr, Chr(13)), "Time Reference"), "*"), 35) 'convert timecode from samples to the number of frames FramesLng = TimeRefStr / (SampleRateStr / FrameRate) 'convert the number of frames to a timecode number 'this uses a TC Function from Matthias Bürcher 'https://www.belle-nuit.com/tc-xla TimeCodeLng = framestoTC(FramesLng, FrameRate) MsgBox (TimeCodeLng) End Sub Function framestoTC(frames As Long, Optional ByVal fps As Double = 25#) 'Many thanks to Matthias Bürcher for this function 'https://www.belle-nuit.com/tc-xla 'Donne le Time Code pour un nombre d'images données. 'L 'indication de fps est facultative (défaut 25). 'Si fps est 29.97, le Time Code est interprété en NTSC drop frame. 'framestoTC(53;24)=00:00:02:05 Dim f As Long Dim s As Long Dim m As Long Dim h As Long Dim sign As Long Dim drop As Boolean Dim TC As Long Dim unit As Long If fps <= 0 Then fps = 25 End If frames = TCNormalize(frames, fps) drop = False If fps = 29.97 Then drop = True fps = 30 ElseIf fps = 59.94 Then drop = True fps = 60 ElseIf fps = 23.98 Then fps = 24 End If If drop Then frames = TCundropit(frames) End If f = frames Mod fps s = (frames \ fps) Mod 60 m = (frames \ (60 * fps)) Mod 60 h = (frames \ (3600 * fps)) Mod 24 framestoTC = f + 100 * s + 10000 * m + 1000000 * h End Function Sub AddTimecodeStyle() ' Adds a style to format 8 digit numbers as timecode Application.StatusBar = "TC.XLA 1.3b2 © Matthias Buercher 1997-2017 www.belle-nuit.com" On Error GoTo StyleError ActiveWorkbook.Styles.Add Name:="TimeCode" With ActiveWorkbook.Styles("TimeCode") .IncludeNumber = True .IncludeFont = False .IncludeAlignment = False .IncludeBorder = False .IncludePatterns = False .IncludeProtection = False End With ActiveWorkbook.Styles("TimeCode").NumberFormat = "00\:00\:00\:00" ActiveWorkbook.Styles.Add Name:="TimeCode DF" With ActiveWorkbook.Styles("TimeCode DF") .IncludeNumber = True .IncludeFont = False .IncludeAlignment = False .IncludeBorder = False .IncludePatterns = False .IncludeProtection = False End With ActiveWorkbook.Styles("TimeCode DF").NumberFormat = "00\:00\:00\;00" Beep StyleError: Beep End Sub