Skip to main content
Jongware
Community Expert
Community Expert
December 8, 2011
Question

[Ann] Identify Your InDesign File

  • December 8, 2011
  • 10 replies
  • 52865 views

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.

    This topic has been closed for replies.

    10 replies

    loyal_operator154A
    Legend
    March 30, 2017

    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

    Aristarco Palacios
    Known Participant
    August 19, 2022

    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 > 😎 {
                 //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!

    tanekab36338788
    Participant
    October 7, 2015

    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.

    Peter Spier
    Community Expert
    Community Expert
    October 7, 2015

    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.

    Known Participant
    July 21, 2015

    Jongware, I don't understand how to use your "identify" file to find out information about my InDesign file. How do I do this?

    Thank you.

    Peter Spier
    Community Expert
    Community Expert
    July 21, 2015

    Like any script, it must be installed.

    How to install scripts in InDesign | InDesignSecrets

    Known Participant
    July 22, 2015

    I installed it and I get the message "this file is not executable by any supported script language".

    What does this mean?

    AnneMarie Concepcion
    Community Expert
    Community Expert
    July 1, 2015

    Jongware this is cool, but wondering if you could update it to show CC, CC 2014, and CC 2015?  (It reports things like "CC.next.next" and "CC.2" instead.)

    thanks!

    AM

    Jongware
    Community Expert
    JongwareCommunity ExpertAuthor
    Community Expert
    July 1, 2015

    AnneMarie, the shift from InDesign 1.0 and InDesign 2.0 to InDesign CS (which is "3") was already quite confusing (and in my opinion totally unnecessary) but at least Adobe managed to stick to this numbering scheme for ... wait for it: 6 versions!

    Alas: since InDesign CC the numbering has become totally unclear to me. The version number (which is what I read out of the document) can no longer be translated linearly into the name "CC", "CC 2014" or "CC 2015" – I don't know any longer what number should correspond to what name, and, possibly worse, I also cannot predict what the next version will be named. ("2016"? "CC 10"? "CD"?)

    It's just one of the cases where marketing decisions defeat common human (and computer) logic.

    davidblatner
    Community Expert
    Community Expert
    July 1, 2015

    While I agree that Adobe's naming is very confusing, I believe there is some logic to it. If you choose About InDesign from the InDesign menu (mac) or Help menu (Windows), you'll see that CC 2015 is version 11. CC 2014 was version 10. CC (which I call CC 2013) was version 9. Adobe seems to be releasing 2 additional versions per year, in October (a .1 sub-version) and then around February or March (a .2 sub-version).

    So version 10.2 could be called "CC 2014.2"... yes?

    Tony722
    Participating Frequently
    September 7, 2012

    Thanks Jongware. That was super helpful!

    Here is how to do the same kind of thing in C#:

    using System;

    using System.Linq;

    using System.IO;

    namespace InDesignWrapper {

      class VersionChecker {

        private byte[] InDesignFileHeader = new byte[] { 0x06, 0x06, 0xED, 0xF5, 0xD8, 0x1D, 0x46, 0xe5, 0xBD, 0x31, 0xEF, 0xE7, 0xFE, 0x74, 0xB7, 0x1D };

        private int byteOrderFlag;

        public string GetInddFileVersion(string filename) {

          var fileinfo = new FileInfo(filename);

          var stream = fileinfo.OpenRead();

          var reader = new BinaryReader(stream);

          var fileHeader = reader.ReadBytes(16);

          if (!fileHeader.SequenceEqual(InDesignFileHeader))

            return "Not an InDesign file";

          string fileType = new String(reader.ReadChars(8));

          byteOrderFlag = reader.ReadByte();

          reader.ReadBytes(4);

          var majorVersion = reader.ReadInt32(byteOrderFlag) - 2;

          var minorVersion = reader.ReadInt32(byteOrderFlag);

          return String.Format("CS {0}.{1}", majorVersion, minorVersion);

        }

      }

      static class BinaryReaderExtensionMethods {

        public static byte[] ReadOrderedBytes(this BinaryReader reader, int count, int byteOrderFlag) {

          if (byteOrderFlag == 2) return reader.ReadBytes(count).Reverse().ToArray();

          return reader.ReadBytes(count);

        }

        public static long ReadInt32(this BinaryReader reader, int byteOrderFlag) {     

          return BitConverter.ToInt32(reader.ReadOrderedBytes(4, byteOrderFlag), 0);

        }

      }

    }

    Participant
    June 7, 2012

    So I can open a CS5.5—with Soxy— and it will then script it and save as CS5.5 rather than auto open the IDD as CS 6? More clarification please.

    Peter Spier
    Community Expert
    Community Expert
    June 7, 2012

    All the script does is tell you what version of InDesign the selected file was saved in. It doesn't open it, save it, or do any other modifications.

    Jongware
    Community Expert
    JongwareCommunity ExpertAuthor
    Community Expert
    June 7, 2012

    Kat clearly didn't read the "Things it Does Not" section

    Participant
    March 14, 2012

    sorry where can i locate the User scripts folder in 10.6.8?

    and how should i launch the script?

    sorry, i am script newbie!

    thanks

    Jongware
    Community Expert
    JongwareCommunity ExpertAuthor
    Community Expert
    March 15, 2012

    10.6.8 must be your OS version, because InDesign is not there yet. Neither is Windows, so (guessing again) you must be using Mac OS X? If you don't get a pop-up menu when you right-click your User scripts in the Scripting panel there may be something wrong with your computer or with InDesign (or possibly the right button on your mouse).

    Did you try the online help? It should direct you here: http://help.adobe.com/en_US/indesign/cs/using/WS0836C26E-79F9-4c8f-8150-C36260164A87a.html

    You could also read http://indesignsecrets.com/how-to-install-scripts-in-indesign.php

    Mr. Met
    Inspiring
    March 17, 2012

    Nifty script and works in 10.3.7 as well as CS5.

    Another useful Jongware script*

    * This is not a paid endorsement.

    davidblatner
    Community Expert
    Community Expert
    February 7, 2012

    I tested this in CS3 and it appears to work. Magic!

    Peter Spier
    Community Expert
    Community Expert
    December 8, 2011

    [Jongware] wrote:

    Things I won't

    "Upgrade" it to actually open the newer files in your old CS3.

    Aw. c'mon. What fun is that? <big wink>

    Community Expert
    December 8, 2011

    Thanks Jongware - that looks good. Not sure what I'll use it for.

    Where did the need for this come from though?

    Jongware
    Community Expert
    JongwareCommunity ExpertAuthor
    Community Expert
    December 8, 2011

    Eugene Tyson wrote:

    Thanks Jongware - that looks good. Not sure what I'll use it for.

    You must be working exclusively with the Very Latest Version.

    This is a tool for people who ask "why can't I open this file in my version of InDesign"; at least we can now unambiguously answer "because this file you got is newer, never mind what your client said."

    (Or we could but we don't have to because now people can find out for themselves.)

    Colin Flashman
    Community Expert
    Community Expert
    December 9, 2011

    this will certainly have a use in my office where i'm on CS3; a colleague has CS4; another colleague has CS5; and soon a different colleague will have 5.5. now when i receive a file i can't open (with no PDF supplied either) i'll know who i have to kick off of which machine!

    assuming it works in CS3... haven't tested that yet

    If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!