Skip to main content
Participating Frequently
November 12, 2009
Answered

how to chek the adobe illustrator document version.

  • November 12, 2009
  • 1 reply
  • 2114 views

hi all,

Can anyone guide me how to check the version of the adobe illustrator document.(currently active document).

I tried using app.version which gives the version of adobe illustrator application i.e 12.0.0 for CS2.

But i want the version of the illustrator document.I tried app.activeDocument.version which gives me the undefined value.

Any suggestion on this ?????

Also please help me on the script for finding out the font type used in the document. e.g. times new roman,arial new etc.

thanks in advance,

Sanat

This topic has been closed for replies.
Correct answer sonicDream

owh dear

var v_fl = "/d/_temp/3ds_eles_msh.ai"


function getFileVersion(v_flToOpen){
    var v_fileObj = new File(v_flToOpen);
    var vrs = null;
    v_fileObj.open("r");

    try{
        while(v_fileObj.tell() < v_fileObj.length) {
            var line = v_fileObj.readln();
            //alert(line.reflect.methods);
            var idxOf = line.indexOf("Creator: Adobe Illustrator(R)");
            if(idxOf > 0) { vrs = line.substring(idxOf+30, line.length);}
        }
    }
    catch(ex) { alert("There is some sort of strange error ... damn, and all was going so well");}
    finally { v_fileObj.close(); return vrs; }

}


var v_fileVersion = getFileVersion(v_fl);

if(v_fileVersion != null) {

     alert("Version of the file is:" + v_fileVersion);

} else {

     alert("Now seriously did you really selected an .ai file? If so, something strange happened!");

}

cheers;

1 reply

MarkWalsh
Inspiring
November 12, 2009

To do that, I believe you're going to have to parse the actual Postscript code. The string to search for is the "%%Creator" as in:

"%%Creator: Adobe Illustrator"

The number after that string will be the version the file is saved as:

%%Creator: Adobe Illustrator(R) 12.0

%%Creator: Adobe Illustrator(R) 10.0

etc. down to

%%Creator: Adobe Illustrator(TM) 3.2

There may be cases where the string doesn't exist (e.g. if it was created outside of Illustrator, e.g. exporting paths from Photoshop), so it's not always 100% accurate. A file exported from Photoshop should have the following Creator code:

%%Creator: Adobe Photoshop(TM) Pen Path Export 7.0

Don't know if there is another way to do this, but would be interested if someone has another alternative.

Muppet_Mark-QAl63s
Inspiring
November 12, 2009

If by chance you are on OSX Tiger or above then you can access this kind of info very fast using spotlights database.