Script help - select and filter Dest folder from Src match

Hi, I am trying to write a script that takes the first part of a filename in the source file display and selects a matching folder in the destination file display. For example:

Source File Display (files):
Bob 2011-10-12.log
Joe 2012-08-14.log
Ali 2012-10-21.log

Dest File Display (folders):
_Bob
_Joe
_Ali
... (long list)

I would like to highlight "Bob 2011-10-12.log" and run my script which selects the _Bob folder in the dest file display (and either uses a filter to only show it or even better enters that folder).

So far I have tried:

  • Regex copy partial filename to clipboard (Clipboard COPYNAMES=nopaths REGEXP "([^. ])(.)" "\1"; Set Source=toggle etc) ... but I can't find any way to paste the clipboard contents to the quickfilter.
  • "Select Sourcetodest" (and desttosource). These do work but of course only if the filename is exactly the same as the folder. (Perhaps I could copy/rename the file first and then use this. Slow for big files)

Any suggestions for commands or addons I could use to help would be appreciated,
thanks,
Spiro

Ok this is ugly but it works using 2 buttons:

Button1 called "Lookup1":
Clipboard COPYNAMES=nopaths REGEXP "([^. ])(.)" "\1"
Set Focus=dest

Button2 called "Lookup2":
Set Quickfilter={clip}
Select none
Select First
GO FROMSEL

Spiro

The second button could be tidied up by using:

Select "{clip}" DESELECTNOMATCH
Go FROMSEL

Or similar.

Combining it all into a single command should be possible but would be a bit fiddly. You could use a VBScript to do everything or you could move the second command into a User Command and call that from the first command (I think that will then evaluate {clip} at the right time).

ooooh THANKS :slight_smile:
I'll try that ASAP.

Yes the User Command worked thanks a lot (I have not tried the VB script yet). I created a User Command called scLookup (template: LOOKUPDIR):

Go &LOOKUPDIR&
Select "{clip}" DESELECTNOMATCH
Go FROMSEL

And then my toolbar button called "Lookup in Logfiles":

Clipboard COPYNAMES=nopaths REGEXP "(^_[^. _])(.*)" "\1"
Go current NEWTAB
scLookup X:_Logs_StudentDaily
Go current OPENINDEST NEWTAB
Go TABCLOSE

As a bonus it opens the logfile top folder in the dest File Display in a new tab so I don't need to open it myself first. Better outcome than initially intended.
Thanks again
Spiro