So, total jscript newbie here. I managed to cobble this script, by using examples here on the forums.
But it does not work. No idea why. Even DOpus.Output does not get called... What am I missing?
var myCustomData;
function OnInit(initData){
initData.name = "TESTING - myCustom Columns";
initData.desc = "This script is just for testing purposes."
initData.version = "1.1";
initData.copyright = "(c) 2017 cryodream"
initData.min_version = "12.5"
initData.default_enable = true;
var col = initData.AddColumn();
col.name = "myCustomStatus";
col.method = "OnMyCustomColumn";
col.label = "Status";
col.header = "Status";
col.justify = "center";
col.autogroup = true;
col.multicol = true;
var col = initData.AddColumn();
col.name = "myCustomCategory";
col.method = "OnMyCustomColumn";
col.label = "Category";
col.header = "Category";
col.justify = "center";
col.autogroup = true;
col.multicol = true;
}
function OnMyCustomColumn(scriptColData) {
if (typeof myCustomData === 'undefined') {
DOpus.Output("myCustomData not found... loading from JSON")
ReadJsonToVariable();
}
else {
DOpus.Output("using previously loaded myCustomData")
}
scriptColData.columns("myCustomStatus").value = myCustomData.Status;
scriptColData.columns("myCustomCategory").value = myCustomData.Category;
}
function ReadJsonToVariable() {
var file = "\info.json";
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fileStream = fso.openTextFile(file);
var fileData = fileStream.readAll();
fileStream.Close();
myCustomData = JSON.parse(fileData);
}
Any help would be very appreciated.