Option Explicit
Function OnClick(ByRef clickData)
Dim folderEnum, folderItem, wild, strSet, strItem
' Create some kind of collection object.
Set strSet = DOpus.Create.StringSetI()
' Create a *.txt wildcard.
Set wild = DOpus.FSUtil.NewWild("*.txt", "f")
' Enumerate our tab's current folder
Set folderEnum = DOpus.FSUtil.ReadDir(clickData.func.sourcetab.path)
Do While (Not folderEnum.complete)
Set folderItem = folderEnum.Next
If (Not folderItem.is_dir) Then ' Ignore directories
If (wild.Match(folderItem.name)) Then
' Add this one.
strSet.insert(folderItem)
End If
End If
Loop
' Output the paths of everything we added, to the script log.
' (Or do whatever you want with them.)
For Each strItem In strSet
DOpus.Output strItem
Next
End Function
If you want it to be recursive (find matching files in sub-dirs), just change the ReadDir line to add the "r"
flag:
Set folderEnum = DOpus.FSUtil.ReadDir(clickData.func.sourcetab.path, "r")