Hello! Are you still there?
I hope you all are fine! o)
I encountered an issue when using a (OnClick() script based) user command in a dragndop context menu - problem description in short:
"data.func.sourcetab" is set to destination tab.
"data.func.desttab" is undefined.
I was testing whether I could get a dragndrop operation to work, where I can drag a "source file" in source onto a file in destination and thereby updating the "destination file" with the contents of the "source file" (and keeping name of "destination file"). I came to the conclusion that DO does not support this, as there is no "target file" property or something when doing the dragndrop action. I think I already tried this in the past. o)
I then tried to create an action in the dragndrop context menu. It also fails, the OnClick() script code does not seem to be triggered. Scripting functionality still seems to be different for FileType related things (still requiring "@script jscript" modifiers and such.. not sure what the status is on this.
So I tried using a user command as action in the dragndrop context menu, I named it "CopyIntoSelectedDestFile_UC" and the code is like this:
function OnClick(data) {
var srcTab = data.func.sourcetab;
var dstTab = data.func.desttab;
DOpus.Output("srcTab: " + srcTab.path); // BUG?!: is DEST tab when used with FileType DragContextMenu
DOpus.Output("dstTab: " + dstTab.path); // BUG?!: is undefined when used with FileType DragContextMenu
if (srcTab.selected_files.count != 1) {
DOpus.Output("More or less than 1 file selected in source, aborting.");
return false;
}
var srcFile = srcTab.selected_files(0);
if (dstTab.selected_files.count != 1) {
DOpus.Output("More or less than 1 file selected in destination, aborting.");
return false;
}
var dstFile = dstTab.selected_files(0);
DOpus.Output("Copy: " + srcFile.realpath + " - " + dstFile.realpath);
var cmd = DOpus.NewCommand();
cmd.RunCommand('COPY FILE="'+srcFile.realpath+'" TO="'+dstFile.path+'" AS="'+dstFile.name+'" WHENEXISTS=replace MOVEWITHSHIFT');
DOpus.Output("OnClick() done.");
};
But this does not work either, since sourcetab/desttab properties seem to be broken (as described upfront.) The user command fails with:
17/02/2023 20:39 Error at line 14, position 2
17/02/2023 20:39 'selected_files.count' is null or not an object (0x800a138f)
Maybe you can look into this?
I updated DO to the latest beta before posting this, to make sure I don't use outdated version.
EDIT: Screenshot of "FileType" configuration:
Thank you! o)