/////////////////////////////////////////////////////////////////////////////// function OnInit(data) { //resource center url added via script wizard (required for updating) var url = "http://resource.dopus.com/viewtopic.php?f=35&t=23507"; //uid added via script wizard (do not change after publishing this script) var uid = "052EDB29-F9EA-433F-A2A4-3E2CDA03EC52"; data.name = "Command.Item: PasteToFolders"; data.desc = "Copy clipboard content into all selected folders."; data.copyright = "tbone"; data.version = "0.1"; data.default_enable = true; /////////////////////////////////////////////////////////////////////////// function ConfigHelper(data){ this.data=data; this.descriptions=null; this.last=null; this.add = function(name, val, description){ this.data.config[name]=val; this.last=[this.data.config[name],name]; if (description!=undefined) this.des(description); return this;} this.des = function(description){ if (!(description && DOpus.version.AtLeast("11.6.1"))) return this; if (!this.descriptions){ this.descriptions=DOpus.NewMap(); data.config._descriptions=this.descriptions; } this.descriptions(this.last[1])=description; return this;} this.val = function(val){ if (typeof this.last[0]=="object") this.last[0].push_back(val); else this.last[0]=val; return this;} } /////////////////////////////////////////////////////////////////////////// var cfg = new ConfigHelper(data); cfg.add("DebugOutput", false). des("Enable debug output in the script console."); } /////////////////////////////////////////////////////////////////////////////// function OnAddCommands(data){ var cmd = data.AddCommand(); cmd.name = "PasteToFolders"; cmd.method = "Command_PasteToFolders"; cmd.desc = "Copy clipboard content into selected folders"; } /////////////////////////////////////////////////////////////////////////////// function Command_PasteToFolders(data){ Debug("PasteToFolders():"); if (data.func.sourcetab.selected_dirs.count==0){ Debug("E No folders selected"); return; } Debug(" Selected folders: " + data.func.sourcetab.selected_dirs.count); var clipData = DOpus.GetClip("files"); if (clipData.count==0){ Debug("E No items in clipboard"); return; } Debug(" Items in clipboard: " + clipData.count); var cmd = DOpus.Create.Command(); cmd.AddFiles(clipData); var foldersEnum = new Enumerator(data.func.sourcetab.selected_dirs); for (;!foldersEnum.atEnd(); foldersEnum.moveNext()){ var folderItem = foldersEnum.item(); Debug(" Copying into ["+folderItem.realpath+"]"); cmd.RunCommand('COPY TO="'+folderItem.realpath+'"'); } } /////////////////////////////////////////////////////////////////////////////// function Debug(text) { try{ if(Script); if (Script.config.DebugOutput) DOpus.Output(text); } catch(e){ DOpus.Output(text); } } /////////////////////////////////////////////////////////////////////////////// function OnAboutScript(data){ //v0.1 var cmd = DOpus.Create.Command(); if (!cmd.Commandlist('s').exists("ScriptWizard")){ if (DOpus.Dlg.Request("The 'ScriptWizard' add-in has not been found.\n\n"+ "Install 'ScriptWizard' from [resource.dopus.com].\nThe add-in enables this dialog and also offers "+ "easy updating of scripts and many more.","Yes, take me there!|Cancel", "No About.. ", data.window)) cmd.RunCommand('http://resource.dopus.com/viewtopic.php?f=35&t=23179');} else cmd.RunCommand('ScriptWizard ABOUT WIN='+data.window+' FILE="'+Script.File+'"'); } //MD5 = "bd7f804370584d0089cd780354d4de9e"; DATE = "2014.12.01 - 15:15:28"