so neither {dlab} nor {$dlab} worked - it's just putting a blank in the path.
Is this even the right variable for the drive of the active lister?
@nofilenamequoting
@set DiskName = {dlgstring|Enter Disk Name}
Copy CREATEFOLDER "C:\catalog\{$dlab}" FILTER="Folders Only"
Copy CREATEFOLDER "D:\catalog\{$DiskName}" FILTER="Folders Only"
lxp
2
The code {dlab}
is used for the Status Bar. I am afraid it is not available for commands.
The drive label can be retrieved via the FileSystemObject, like in this demo script
function OnClick(clickData) {
var cmd = clickData.func.command;
var tab = clickData.func.sourcetab;
var dlg = clickData.func.Dlg();
var fso = new ActiveXObject('Scripting.FileSystemObject');
cmd.deselect = false; // Prevent automatic deselection
if (tab.path.drive == 0) {
dlg.Request('Please select a drive!', 'OK');
} else {
var srcDrive = fso.GetDrive(tab.path);
var srcLabel = srcDrive.VolumeName;
dlg.Request('Drive Label: ' + srcLabel, 'OK');
}
}
Show Drive Label.dcf (1.2 KB)
Looks like I can't mix this with my standard DOpus script.
I'd have to redo the whole thing in DOpus's internal version of JScript?
lxp
4
Yes. Like so:
function OnClick(clickData) {
var cmd = clickData.func.command;
var tab = clickData.func.sourcetab;
var dlg = clickData.func.Dlg();
var fso = new ActiveXObject('Scripting.FileSystemObject');
cmd.deselect = false; // Prevent automatic deselection
if (tab.path.drive == 0) {
dlg.Request('Please select a drive!', 'OK');
} else {
var srcDrive = fso.GetDrive(tab.path);
var srcLabel = srcDrive.VolumeName;
var diskName = dlg.GetString('Enter Disk Name');
cmd.RunCommand('Copy CREATEFOLDER "C:\\catalog\\' + srcLabel + '" FILTER="Folders Only"');
cmd.RunCommand('Copy CREATEFOLDER "D:\\catalog\\' + diskName + '" FILTER="Folders Only"');
}
}
1 Like