Copy link to clipboard
Copied
A CS4 & upwards compatible script -- if anyone dares to try it out in a lower version, please do so. It pops up a standard file dialog where you can select any file, and the script will dive into it and see what version of InDesign it was last saved with.
Download the zip from my website: identify.zip -- unpack, and put "IDentify.jsx" to the folder where you put all of your User scripts.
Things it does
It shows the file name, file type (as stored in the file), and version of InDesign files from InDesign version CS up to CS5.5 (tested). It does not work for ID 1.0, 1.5, 2.0. It may not work for versions after CS5.5.
Things it doesn't
It does not open the newer files in your old CS3.
It does not identify IDML files (nor anything else, by the way, than InDesign files).
It does not Fix Your Broken Files.
Written using CS4, so it may or may not work on older or newer versions.
Things I won't
"Upgrade" it to actually open the newer files in your old CS3.
Explain how it works.
Unobfuscate to make it clear how it works.
Respond to Private Mail inquiries of how it works.
Copy link to clipboard
Copied
Double-click the script name in the Scripts panel.
Copy link to clipboard
Copied
Got it! It works! Great, thanks so much.
Copy link to clipboard
Copied
I really need help. I am using the newest version of Indesign and I saved it as Idml but it won't open. It says it may not support it or there may be a missing plugin. Tried from another computer but it still won't open.
Copy link to clipboard
Copied
How did you save the file as IDML? That particular error generally means there is a lock file present, or the file you are trying to open isn't a format readable by InDesign.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hello
I might be doing this too little too late but I've just found this thread as of August 2022. I ran the script but kept telling me the file could be opened even when the file was CC2020 and the app.version was CC2019. I think I've solved it by eliminating the version variable and correcting the index to the array on the fly. I've just included the fragment with the changes.
Hope this helps someone.
if (l >= 3) {
if (l == 3) l2 = "CS";
else if (l > 8) {
//l2 = "CC";
//while (l-- > 9) l2 += '.next';
//var version = 0; // didn't need another variable
var CCversions = ["CC", "CC 2014", "CC 2015", "CC 2017", "CC 2018", "CC 2019", "CC 2020", "CC 2021", "CC 2022"]; // <- add new versions here; and yes, "CC 2016" was skipped by Adobe
//while (l-- > 9) version++; //This made l, the file version, smaller than the app.version
//l2 = CCversions[version]; //Not using the version variable anymore
l2 = CCversions[l-9]; //correct the index to the CC versions array on the fly
} else l2 = "CS"+(l-2);
}
Cheers!