/* =============================================================================== Source : https://resource.dopus.com/t/paste-here-to-new-subfolder/41190 Function : Paste Here with Path Created : 2022-05-06 Modified : 2023-11-11 Version : v0.3 =============================================================================== */ function OnClick(clickData) { var cmd = clickData.func.command; cmd.ClearFiles(); if (DOpus.GetClipFormat() != 'files') return; var clipFiles = DOpus.GetClip('files'); var firstItemPath = clipFiles(0).path + ""; var fsu = DOpus.FSUtil; var path = clickData.func.sourcetab.path; path = fsu.Resolve(path); var newPath = path + "\\" + firstItemPath.replace(/\b[A-Z]:\\/g, ""); var dlg = clickData.func.Dlg(); dlg.title = "Directory Opus"; // Title dlg.template = "dlgCombox"; dlg.detach = true; dlg.Create(); dlg.Control("static").style = "b"; dlg.Control("static").label = "Paste Here with Path"; // Topic dlg.Control("static2").label = "Select or enter folder name or subpath"; // Notes dlg.Control("static3").label = "D:\\Icons\\COPY MOVE.png"; // Icon dlg.Control("combo").label = newPath; // Defalut value dlg.Control("combo").SelectRange(0, -1); // Select defalut value dlg.Control("combo").AddItem(newPath); // Add each item to drop-down list for (i = 0; i < clipFiles.count; i++) { dlg.Control("combo").AddItem(clipFiles(i).name_stem_m); } dlg.Show(); // msg loop do { msg = dlg.GetMsg(); /* // Selection if (msg == true && dlg.Control("combo").focus == true) { DOpus.Output(dlg.Control("combo").label); } */ // Result, perform the paste operation if (dlg.result == 1) { // Add string trim() method String.prototype.trim = function(s){s=s||"\\s";return this.replace(new RegExp("^("+s+"){1,}\|("+s+"){1,}$","g"),"");} var input = dlg.Control("combo").label.trim(); if (!input) {return} cmd.RunCommand('CreateFolder READAUTO=no NAME="' + input + '"'); if (fsu.Exists(input)) cmd.SetSource(input); else cmd.SetSource(path + "\\" + input); cmd.RunCommand('Clipboard PASTE'); } /* // If the button 3 is pressed if (dlg.result == 2) { DOpus.Output("Button 3 is pressed"); } // If the button 4 is pressed if (dlg.result == 3) { DOpus.Output("Button 4 is pressed"); } */ } while (msg == true); } ==SCRIPT RESOURCES