/* =============================================================================== Source : https://resource.dopus.com/t/paste-here-to-new-subfolder/41190/7 Function : Paste (Copy) Here to New Subfolder Created : 2022-05-06 Modified : 2022-11-30 Version : v0.3 =============================================================================== */ function OnClick(clickData) { var cmd = clickData.func.command; cmd.ClearFiles(); if (DOpus.GetClipFormat() != 'files') return; var clipFiles = DOpus.GetClip('files'); var firstName = clipFiles(0).name_stem_m; var fsu = DOpus.FSUtil; var path = clickData.func.sourcetab.path; path = fsu.Resolve(path); 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 (Copy) Here to New Subfolder"; // Topic dlg.Control("static2").label = "Select or enter folder name or subpath"; // Notes dlg.Control("static3").label = "D:\\Icons\\XYplorer Pane C-M COPY MOVE.png"; // Icon dlg.Control("combo").label = firstName; // Defalut value dlg.Control("combo").SelectRange(0, -1); // Select defalut value for(i = 0; i < clipFiles.count; i++) { dlg.Control("combo").AddItem(clipFiles(i).name_stem_m); //Add each item to drop-down list } 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) { var input = dlg.Control("combo").label; if(input == "") {return}; cmd.RunCommand('CreateFolder READAUTO=no NAME="' + input + '"'); path.Add(input); cmd.SetSource(path); 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