GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Copy MOVE HERE AS doesn't work from script


#1

Copy MOVE HERE AS seems to ignore the HERE when called from a script.

Assume two folders with two files:

foo
    foo.txt

bar
    bar.txt

Select folder bar and execute

Copy MOVE HERE AS="foo"

from a button or as a direct command. The result is as expected:

foo
    foo.txt
    bar.txt

Now execute the same from a script:

function OnClick(clickData) {
    var cmd = clickData.func.command;
    cmd.RunCommand('Copy MOVE HERE AS="foo"');
}

The folder bar will appear as foo in the destination with bar.txt in it.

It's not meant to be like this, or is it?


#2

It's a side effect of how the HERE argument is handled internally. It's only looked at if the function doesn't have a destination path specifically defined, but when the command is launched from a script it does.

You can probably get the same result with cmd.SetDestTab(cmd.sourcetab);.


#3

Ah, yes, works!
The subtleties of scripting :slight_smile: