The current tutorial shows adding a cascading folder to the context menu. Can this be enhanced so that if the control key is held, the selected item(s) would be copied to that folder, and if the shift key is held, it would move to the folder? Similarly, if the alt key is held it would move the selected file/folder to the current folder and the alt shift would move the selected file/folder to the current folder.
Likely will be possible in the next beta using an embedded command and @keydown.
At the moment, you can do some of that but not all at once.
Hi Leo,
I don't see this mentioned in the release history for 13.7.5 or 13.7.6. Is it available now?
Yes.
You will need a script command to access files selected in the file display.
Try CopyFoldercontent in a context menu like this:
Go PATH=/profile FOLDERCONTENT=embeddedcmddirs
[CopyFoldercontent]
Save CommandCopyFoldercontent.js.txt to ↓
%appdata%\GPSoftware\Directory Opus\Script AddIns
How to use buttons and scripts from this forum
JScript
function OnInit(initData) {
initData.name = 'CopyFoldercontent';
initData.version = '2024-07-10';
initData.url = 'https://resource.dopus.com/t/go-foldercontent/51626';
initData.desc = 'CopyFoldercontent';
initData.default_enable = true;
initData.min_version = '12.0';
}
function OnAddCommands(addCmdData) {
var cmd = addCmdData.AddCommand();
cmd.name = 'CopyFoldercontent';
cmd.method = 'OnCopyFoldercontent';
cmd.desc = 'CopyFoldercontent';
cmd.label = 'CopyFoldercontent';
cmd.hide = false;
cmd.icon = 'script';
}
function OnCopyFoldercontent(scriptCmdData) {
var cmd = scriptCmdData.func.command;
var tab = scriptCmdData.func.sourcetab;
var qlf = scriptCmdData.func.qualifiers;
var fsu = DOpus.FSUtil();
cmd.deselect = false;
if (!cmd.files.count) return;
var dstPath = fsu.Resolve(cmd.files(0));
var dstType = fsu.GetType(dstPath);
if (qlf == 'ctrl') {
cmd.SetFiles(tab.selected);
cmd.SetDest(dstPath);
cmd.RunCommand('Copy');
} else if (qlf == 'shift') {
cmd.SetFiles(tab.selected);
cmd.SetDest(dstPath);
cmd.RunCommand('Copy MOVE');
} else if (qlf == 'alt') {
cmd.SetDest(tab.path);
cmd.RunCommand('Copy');
} else if (qlf == 'shift,alt') {
cmd.SetDest(tab.path);
cmd.RunCommand('Copy MOVE');
} else {
if (dstType == 'file') {
cmd.RunCommand(dstPath);
} else {
cmd.RunCommand('Go PATH="' + dstPath + '"');
}
}
}
Thanks lxp. I wasn't even thinking it in this direction.
There are two more things I wanted to achieve here
- Show a ".." to move upwards the directory so that I can start the path at current location
- Have the folder content start at different locations. I would be able to achieve this by duplicating the submenu. Is there another way for achieving this
I don't think this can be added to the dynamic menu. You could have a separate command Go UP
and name it ..
.
I might have misunderstood what you wanted, though.
You can pass multiple paths like this:
Go PATH=/desktop|/profile FOLDERCONTENT
You'll have a unified menu with all items sorted.
Great thanks.
For .., I wanted it to show the cascading menu from there onwards. But that's fine. This was really a great help. Thank you once again.
Is CommandCopyFoldercontent supposed to copy or move the selected file to a folder accessed via Folderconent using the ctrl or shift modifiers? It is not doing so for me. It simply opens the selected folder. Here is the button I am using. TIA
Jim's Documents.dcf (750 Bytes)
Yes.
Do you run at least 13.7.4?
13.7.8
That's odd. Works fine here, both as context menu and as button.
Is the script enabled?
Status=OK
It's working now under Opus 13.8.
That's even more surprising than it not working before!
Would you mind trying 13.7.8 again?
It worked under 13.7.8 when I tried again. I think the problem was me; I was doing something wrong and now can't even imagine what it was.
Here is a button taking advantage of this script. Set your own commonly accessed drive. You could also create a three button button to go to three different commonly used drives.
Copy or Move Selected Items to 'T;_' Folders or Source Display.dcf (957 Bytes)