GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Select Similar Files With Double Extensions


#1

So I have these files in folder "Note" open up in Destination pane:
Note1.txt
Note2.txt
Note3.txt

I have these files in a different folder "Info" than above in Source pane:
Note1.txt.info
Note2.txt.info
Note3.txt.info

Is there a good way to select all matching files in the first Destination folder while in the Source pane, or vice-versa? Because I tried using Select SIMILARBASE but it does not work well since Note*.txt.info basically have double extensions. SIMILARBASE works fine when it's simply the same name with a different extension.

Also, is there a good way to quickly visually filter out the files/folders that matches in conjunction with selecting them?


#2

Anyone? Basically I want to use Select SIMILARBASE but instead of selecting all files with a similar base in the Source pane, I want it to select the files with a similar base in the Destination pane. Similar to how Select SOURCETODEST=in would have behaved.


#3

Here's a script that will do it:

Option Explicit
Function OnClick(ByRef clickData)

	if clickData.func.sourcetab.lister.dual = 0 then Exit Function

	Dim files
	Set files = DOpus.Create.StringSetI

	Dim f, g
	for each f in clickData.func.sourcetab.selected

		for each g in clickData.func.desttab.all
			if StrComp(g.name_stem, f.name, 1) = 0 then files.insert g
		next

	next

	if not files.empty then
	
		Dim cmd	
		Set cmd = DOpus.Create.Command
		cmd.deselect = false
		cmd.SetSourceTab clickData.func.desttab

		for each f in files
			cmd.AddFile f
		next

		cmd.RunCommand "Select FROMSCRIPT"

	end if
	
End Function

#4

Thank you! It works splendidly!