CopyFromFiles (Copy files from text files)

The script command CopyFromFiles copies files it finds as links in the selected text files.

The script analyses the selected files and internally replaces the selection with the file links it finds.

It then runs the Copy command with all arguments from the original command line.

This means:

  1. All arguments available to Copy can be used for CopyFromFiles.
  2. The selection will be ignored, if the FROM argument is used.


// analyse selected files and copy to destination

// analyse selected files and move to D:\heyho
CopyFromFiles MOVE TO=D:\heyho 
function OnInit(initData) { = 'CopyFromFiles';
    initData.version = '2022-12-16';
    initData.copyright = 'CopyFromFiles';
    initData.url = '';
    initData.desc = 'CopyFromFiles';
    initData.default_enable = true;
    initData.min_version = '12.0';

function OnAddCommands(addCmdData) {
    var cmd = addCmdData.AddCommand(); = 'CopyFromFiles';
    cmd.method = 'OnCopyFromFiles';
    cmd.desc = 'Copy files from links found in selected files';
    cmd.label = 'CopyFromFiles';
    cmd.template = '';
    cmd.hide = false;
    cmd.icon = 'script';

function OnCopyFromFiles(scriptCmdData) {
    var cmd = scriptCmdData.func.command;

    cmd.deselect = false;

    var selFiles = DOpus.Create().Vector(cmd.files);


    for (var e = new Enumerator(selFiles); !e.atEnd(); e.moveNext()) {
        var item = e.item();

    cmd.RunCommand(scriptCmdData.cmdline.replace(/CopyFromFiles/i, 'Copy'));

How to install and use

Save CommandCopyFromFiles.js.txt to

%appdata%\GPSoftware\Directory Opus\Script AddIns

and add the new command to a button, hotkey, context menu etc. like any built-in command.