After browsing the forum and modifying some scripts, I'm trying to adding a title: metadata fromm the filename, but I couldn't get it to work.
I'd prefer to to name the title metadata everything after the first symbol "-", however, my current script is written for everything after the first 6 symbols, which should suffice.
Either way, I can't get this script to work either.
Option Explicit
Function OnClick(ByRef clickData)
Dim cmd, selItem, re, title, path, strCommand
Set cmd = clickData.func.command
cmd.deselect = false
Set re = CreateObject("VBScript.RegExp")
re.IgnoreCase = true
re.Global = false
re.Pattern = "......(.+)"
If clickData.func.sourcetab.selected.count > 0 Then
For Each selItem In clickData.func.sourcetab.selected
If selItem.metadata = "video" Then
If re.test(selItem.name) Then
title = re.Replace(selItem.name, "$1")
path = selItem
'strCommand = "SetAttr """ & path & """ META ""artist:" & artist & """ ""year:" & year & """ ""comment:" & comment & """ ""title:" & title & """ ""keywords:" & tags & """"
strCommand = "SetAttr """ & path & "title:" & title
cmd.RunCommand strCommand
End If
End If
Next
End If
End Function
In the script, look for the line that starts with re.Pattern and replace that line with the fist line lxp wrote.
The strCommand line that lxp wrote replaces the only line that starts with strCommand in the script. Ignore the 'strCommand (starts with a single quote character) as that single quote means it is a comment. You can even delete it, if you wish.
Option Explicit
Function OnClick(ByRef clickData)
Dim cmd, selItem, re, title, path, strCommand
Set cmd = clickData.func.command
cmd.deselect = false
Set re = CreateObject("VBScript.RegExp")
re.IgnoreCase = true
re.Global = false
re.Pattern = ".*?-(.*)"
If clickData.func.sourcetab.selected.count > 0 Then
For Each selItem In clickData.func.sourcetab.selected
If selItem.metadata = "video" Then
If re.test(selItem.name) Then
title = re.Replace(selItem.name, "$1")
path = selItem
strCommand = "SetAttr """ & path & """ META ""title:" & title & """"
cmd.RunCommand strCommand
End If
End If
Next
End If
End Function