I have been adapting a button script ([url]"Move to Server" Button Script]) that I wrote in VBScript into an add-on command using JavaScript instead (mainly so I could learn it).
I have used tbone's 'Demo.Generic: ConfigHelper' to set-up the configuration options for the Preferences/Scripts section. These options had to be modified within the script previously.
I initially set up a vector (until I realised I couldn't use a vector for what I wanted). After a bit of trial and error, I found that I could set up a Map object in the configuration section.
The Map object works great in the script with pre-configured 'key,value' pairs, but I have found that I am unable to edit the Map elements from within the configuration option in the preferences/scripts. I double-click the FileStem entry and the Configuration Editor window opens up but it is empty. If I add anything to it, it breaks my script (see below).
This is the portion of the code I am using that creates the Map configuration entry (and the script works fine with this line):
cfg.add("FileStem", DOpus.NewMap("cal","Calibre\\","ccs","CCleaner\\","cdb","CDBXP\\","DOp","DOpus\\V11\\","Dro","Dropbox\\","Med","MediaMonkey\\","Goo","GoodSync\\V9\\","iTu","Apple\\","Tea","TeamViewer\\"),"Define the 1st 3 (or keyLength value) unique chars of file name and matching folder.");
This what I see in preferences:
I have also tried defining an empty Map in the configuration line above and then entering the elements via the preferences/scripts/.../configuration editor - although I'm not sure of the correct format for the 'key,value' pair (I tried '"key,value", '"key","value"', both with and without opening and closing brackets '()'. When I do this, the script produces an error saying that '...method is not supported in line..." which is where the I use this bit of code:
[code]selStem = desFile.slice(0,Script.config.keyLength); // get 1st 3 (or whatever keyLength is set to) chars of selected file name
if (Script.config.FileStem.exists(selStem)) // script breaks here with an empty Map in configuration section[/code]
Is this a 'bug' or am I not able to add/delete/edit the Map elements from the configuration editor? Obviously if anyone else wanted to use my script then they would need to add their own elements to the map object.
I hope that all makes sense.