I made some modifications, so now it seems to show correct CC version, like CC 2015 or CC 2017 + some minor code formatting //DESCRIPTION:Test InDesign file for version // A Jongware Script 27-Jun-2013 /* Modified 30 March 2017 By: Oleh Melnyk Reason: to show actual CC version, for example "CC 2014" or "CC 2017" instead of "CC.next" or "CC.next.next.next"; + some general code formatting */ #target: indesign; var scriptName = "Test InDesign file for version"; // A Jongware Script var scriptVersion = " (30 March 2017)"; // start with a space var iddFile = File.openDialog("Select an InDesign file", "InDesign file:*.indd;*.indt", true); if (iddFile == null) exit(0); var f = File(iddFile); var filename = f.displayName; if (f.open("r") == false){ alert ("Unable to open this file!", "Error", 1); exit(); } else { f.encoding = "binary"; var g = f.read (16); var h = f.read(8); var j = f.read(1).charCodeAt(0); var k = f.read(4); var l = gl (f, j); var l_m = gl (f, j); var m = f.length; f.seek (280); var i = gl (f, 0)*4096; f.close(); if (g != "\x06\x06\xED\xF5\xD8\x1D\x46\xe5\xBD\x31\xEF\xE7\xFE\x74\xB7\x1D"){ alert ("This is not a valid InDesign document"); exit(); } else { if (l >= 3) { if (l == 3) l2 = "CS"; else if (l > 8) { //l2 = "CC"; //while (l-- > 9) l2 += '.next'; var version = 0; var CCversions = ["CC", "CC 2014", "CC 2015", "CC 2017", /*Just a prediction for future versions > */"CC 2018", "CC 2019", "CC 2020"]; // <- add new versions here; and yes, "CC 2016" was skipped by Adobe while (l-- > 9) version++; l2 = CCversions[version]; } else l2 = "CS"+(l-2); } if (l_m != 0) l2 = l2+"."+l_m; if (m < i){ alert ("File: "+filename+"\r"+ "Reported type: "+h+"\r"+ "Reported version: "+l2+"\r\r"+ "Length of this file is less than expected — it may be damaged!", scriptName+scriptVersion, 1); } else { if (parseFloat(app.version) < l) { if (parseFloat(app.version) < 4) { alert ('You cannot open "'+filename+'" because it was saved with a newer version of Adobe InDesign ('+l2+').\r'+ 'You must use that version or later to open the file. To then enable it to be opened in this version, export to IDML, then use InDesign CS4 to export to INX.', scriptName+scriptVersion, 1); } else { alert ('You cannot open "'+filename+'" because it was saved with a newer version of Adobe InDesign ('+l2+').\r'+ 'You must use that version or later to open the file. To then enable it to be opened in this version, export to IDML.', scriptName+scriptVersion, 1); } } else { alert ('You can open "'+filename+'" with this InDesign version.\rIt has been saved as Adobe InDesign ('+l2+').', scriptName+scriptVersion); } } } } function gl (a,b) { var c = a.read(4); if (b == 2) return (c.charCodeAt(3)) + (c.charCodeAt(2) << 8) + (c.charCodeAt(1) << 16) + (c.charCodeAt(0) << 24); return (c.charCodeAt(0)) + (c.charCodeAt(1) << 8) + (c.charCodeAt(2) << 16) + (c.charCodeAt(3) << 24); } Lines 57-62 responds for showing correct CC version
... View more