/* =============================================================================== Function : ADS Tags Column Created : 2022-11-15 Modified : 2023-01-05 Version : v1.2.1 =============================================================================== */ function OnInit(data) { data.name = "ADS Tags Column"; data.desc = "ADS Tags Column. RefreshColumnADS"; data.url = ""; data.copyright = "Ken"; data.version = "1.2.1"; data.min_version = "12.0"; data.default_enable = true; var col = data.AddColumn(); col.autorefresh = true; col.name = "ADS Tags"; col.header = "ADS Tags"; col.label = "ADS Tags"; col.method = "Column_ADS"; col.justify = "left"; col.type = "text"; } function Column_ADS(data) { // String trim() //String.prototype.trim = function(s){s=s||"\\s";return this.replace(new RegExp("^("+s+"){1,}\|("+s+"){1,}$","g"),"");} var fsu = DOpus.FSUtil; var ADSfile = data.item.realpath + ":Tags"; // ADS file // If ADS file exists if (fsu.Exists(ADSfile)) { var ST = DOpus.Create.StringTools(); var openText = fsu.OpenFile(ADSfile, "r"); // Read file var text = openText.Read(); openText.Close; var textbom = ST.Decode(text, "utf-8 bom"); // Decode as UTF-8 with BOM var myArray = textbom.split("\r\n"); // The seprator is \r\n var ADS = myArray[0]; // Get the first line } else {var ADS = ""} // trim //var ADS = String(ADS).trim(); data.value = ADS; // Returns String to the column return } // Add the refresh column command: RefreshColumnADS function OnAddCommands(data) { var cmd = data.AddCommand(); cmd.name = "RefreshColumnADS"; cmd.method = "Command_RefreshColumn"; } function Command_RefreshColumn() { Script.RefreshColumn("ADS Tags"); }