SetAttr from Clipboard date

Here's the VBScript code:

[code]@script VBScript
Option Explicit
Function OnClick(ByRef clickData)
Dim re, fileItem, fileDate, cmdString

clickData.Func.command.deselect = False
clickData.Func.command.ClearFiles

Set re = new RegExp
re.Pattern = "^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\.[^.]+)$"

For Each fileItem in clickData.Func.sourceTab.selected_files
	If (re.Test(fileItem.name)) Then
		fileDate = re.Replace(fileItem.name, "$1-$2-$3 $4:$5:$6")
		cmdString =  "SetAttr FILE=""" & fileItem.realpath & """ CREATED=""" & fileDate & """"
		clickData.Func.command.RunCommand cmdString
	End If
Next

End Function[/code]

Here's it is in XML button form, ready to paste on to a toolbar:

<?xml version="1.0"?> <button backcol="none" display="both" icon_size="large" label_pos="right" textcol="none"> <label>Set Date from Name</label> <icon1>#setdate</icon1> <function type="script"> <instruction>@script VBScript</instruction> <instruction>Option Explicit</instruction> <instruction>Function OnClick(ByRef clickData)</instruction> <instruction> Dim re, fileItem, fileDate, cmdString</instruction> <instruction /> <instruction> clickData.Func.command.deselect = False</instruction> <instruction> clickData.Func.command.ClearFiles</instruction> <instruction /> <instruction> Set re = new RegExp</instruction> <instruction> re.Pattern = &quot;^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\.[^.]+)$&quot;</instruction> <instruction /> <instruction> For Each fileItem in clickData.Func.sourceTab.selected_files</instruction> <instruction> If (re.Test(fileItem.name)) Then</instruction> <instruction> fileDate = re.Replace(fileItem.name, &quot;$1-$2-$3 $4:$5:$6&quot;)</instruction> <instruction> cmdString = &quot;SetAttr FILE=&quot;&quot;&quot; &amp; fileItem.realpath &amp; &quot;&quot;&quot; CREATED=&quot;&quot;&quot; &amp; fileDate &amp; &quot;&quot;&quot;&quot;</instruction> <instruction> clickData.Func.command.RunCommand cmdString</instruction> <instruction> End If</instruction> <instruction> Next</instruction> <instruction /> <instruction>End Function</instruction> </function> </button>