//v0.1 - 2014.09 //- initial version //v1.2 - 2015.05 //- maximum level of compactness reached o) //- removed support for early DO v11 releases //- replaced deprecated methods and approaches with current standards //- error fix (occured if OnInitData was not called just "data") //- added trn() method for fetching translations (translator class needed) /////////////////////////////////////////////////////////////////////////////// function OnInit(data) { //uid added via script wizard (do not change after publishing this script) var uid = "1C0E324C-2E45-4537-ACCB-A1FE8BFBCB98"; //resource center url added via script wizard (required for updating) var url = "http://resource.dopus.com/viewtopic.php?f=35&t=22979"; data.name = "Xtra.Demo: ConfigHelper"; data.desc = "Demonstration on how to use ConfigHelper class."; data.copyright = "tbone"; data.version = "1.2"; data.default_enable = false; /////////////////////////////////////////////////////////////////////////// function ConfigHelper(data){ //v1.2 var t=this; t.d=data; t.c=data.config; t.cd=DOpus.Create.Map(); t.add=function(name, val, des){ t.l={n:name,ln:name. toLowerCase()}; return t.val(val).des(des);} t.des=function(des){ if (!des) return t; if (t.cd.empty) t.d.config_desc=t.cd; t.cd(t.l.n)=des; return t;} t.val=function(val){ var l=t.l; if (l.v!==l.x&&typeof l.v=="object") l.v.push_back(val);else l.v=t.c[l.n]=val;return t;} t.trn=function(){return t.des(t("script.config."+t.l.ln));}} /////////////////////////////////////////////////////////////////////////// var cfg = new ConfigHelper(data); /////////////////////////////////////////////////////////////////////////// //boolean value cfg.add("DebugOutput0", false, "Enable debug output in the script console.0"); //string value cfg.add("UtilityPath0", "/home/toosl/utility.exe", "Full path to utility.exe.0"); //dopus vector cfg.add("Dropdown0", DOpus.Create.Vector(), "Define extended options right here.0"). val(0).val("Option #1").val("Option #2").val("Option #3"); //dopus multiline string cfg.add("MultiLineGreeting0", "Hello! \r\nJust to say hi! o)\r\n", "Your custom greeting, you can make use of multiple lines.0"); /////////////////////////////////////////////////////////////////////////// //boolean value cfg.add("DebugOutput1", false, "Enable debug output in the script console.1"); //string value cfg.add("UtilityPath1", "/home/toosl/utility.exe", "Full path to utility.exe.1"); //dopus vector cfg.add("Dropdown1", DOpus.Create.Vector(), "Define extended options right here.1"). val(0). val("Option #1"). val("Option #2"). val("Option #3"); //dopus multiline string cfg.add("MultiLineGreeting1", "Hello! \r\nJust to say hi! o)\r\n", "Your custom greeting, you can make use of multiple lines.1"); /////////////////////////////////////////////////////////////////////////// //boolean value cfg.add("DebugOutput2", false). des("Enable debug output in the script console.2"); //string value cfg.add("UtilityPath2", "/home/toosl/utility.exe"). des("Full path to utility.exe.2"); //dopus vector cfg.add("Dropdown2", DOpus.Create.Vector()). des("Define extended options right here.2").val(0). val("Option #1").val("Option #2"). val("Option #3"); //dopus multiline string cfg.add("MultiLineGreeting2", "Hello! \r\nJust to say hi! o)\r\n"). des("Your custom greeting, you can make use of multiple lines.2"); /////////////////////////////////////////////////////////////////////////// //boolean value cfg.add("DebugOutput3"). val(false). des("Enable debug output in the script console.3"); //string value cfg.add("UtilityPath3"). val("/home/toosl/utility.exe"). des("Full path to utility.exe.3"); //dopus vector cfg.add("Dropdown3"). val(DOpus.Create.Vector()). val(0). val("Option #1"). val("Option #2"). val("Option #3"). des("Define extended options right here.3"); //dopus multiline string cfg.add("MultiLineGreeting3"). val("Hello! \r\nJust to say hi! o)\r\n"). des("Your custom greeting, you can make use of multiple lines.3"); /////////////////////////////////////////////////////////////////////////// //boolean value cfg.add("DebugOutput4").des("Enable debug output in the script console.4"). val(false); //string value cfg.add("UtilityPath4").des("Full path to utility.exe.3"). val("/home/toosl/utility.exe"); //dopus vector cfg.add("Dropdown4").des("Define extended options right here.4"). val(DOpus.Create.Vector()). val(0). val("Option #1"). val("Option #2"). val("Option #3"); //dopus multiline string cfg.add("MultiLineGreeting4").des("Your custom greeting, you can make use of multiple lines.4"). val("Hello! \r\nJust to say hi! o)\r\n"); } /////////////////////////////////////////////////////////////////////////////// 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 = "531ed4edcf8676cdecffc508db25a41b"; DATE = "2015.05.27 - 02:21:42"