Filter/Select Multiple Files

Hi,

I'm looking for a way to select files by grabbing names from the clipboard.
Let's say I have a CSV like clipboard entry: IA4BTO4GG, IA3WKT40K, IA4BU64FX, IA3WKTG4F
Now I want to make a button or anything that will look into the current view (either a folder or a flat view) and select or filter these 4 items. What would be the best approach for this?

Thanks!
-Johan

Two quick hacks.

Select

function OnClick(clickData) {
    if (DOpus.GetClipFormat() != 'text') return;

    var cmd = clickData.func.command;
    var tab = clickData.func.sourcetab;
    cmd.deselect = false;

    var items = DOpus.GetClip().split(', ') || [];
    cmd.ClearFiles();
    for (var i = 0; i < items.length; ++i) {
        cmd.AddFile(tab.path + '\\' + items[i]);
    }
    cmd.RunCommand('Select FROMSCRIPT SETFOCUS');
}

CSV Select From Clipboard.dcf (1.1 KB)

Filter

function OnClick(clickData) {
    if (DOpus.GetClipFormat() != 'text') return;
    var cmd = clickData.func.command;
    var filter = '"(' + DOpus.GetClip().replace(/, /g, '|') + ')"';
    cmd.RunCommand('Set QUICKFILTER=' + filter);
}

QuickFilterFromClipboard.dcf (741 Bytes)


2 Likes

This is awesome stuff, I will implement it asap and report back.
Thanks a lot!