Copy link to clipboard
Copied
Hi All,
I need to identify the Application Version [Cs/Cs2/Cs3].
Is there any way to identify using javascript???
Regards,
Ramkumar .P
Thanks to all who replied.
I got the answer by "CreatorToo>Adobe InDesign [3/4/5]".
Regards,
Ramkumar .P
Copy link to clipboard
Copied
app.version gives the Indesign version, wich is two notches up from the CS version.
switch (parseInt (app.version))
{
caseof 4: $.writeln "CS3"; break;
caseof 5: $.writeln "CS4"; break;
// etc.
}
Peter
Copy link to clipboard
Copied
Hi Peter,
I think Ramkumar want to know in which application version indesign document created.
Shonky
Copy link to clipboard
Copied
Then this may help…
http://indesignsecrets.com/utility-opens-indd-files-in-the-correct-version-of-indesign-in-osx.php
Copy link to clipboard
Copied
Shonkyin wrote:
I think Ramkumar want to know in which application version indesign document created.
Then he need to check 30th byte of INDD file.
2 - ID 2.0.2
3 - CS1
4 - CS2
5 - CS3
6 - CS4
robin
www.adobescripts.com
Copy link to clipboard
Copied
Are you sure it's always the 30th byte?
You can also search the file for:
/<x(a|m)p:CreatorTool>Adobe InDesign \d/
And the digit at the end will be the version number...
Harbs
Copy link to clipboard
Copied
Harbs. wrote:
Are you sure it's always the 30th byte?
Yes, I'm sure
I'm using this method in my scripts and I've checked this in HEX editor before replying.
robin
www.adobescripts.com
Copy link to clipboard
Copied
Okay. Good to know...
How did you figure this out?
Harbs
Copy link to clipboard
Copied
Harbs. wrote:
Okay. Good to know...
How did you figure this out?
I don't remember
This could be my idea or this could be mentioned on this forum.
I can't verify it now - but if I good remember - the same way you can check CorelDRAW file version
robin
www.adobescripts.co.uk
Copy link to clipboard
Copied
I found below code on Adobe forum.
f = File.openDialog ('Select file', undefined, false);
alert('Indesign version: '+getFileVersion(f));
function getFileVersion(f){
var IDVersion;
f.open('r')
f.seek(29, 0)
IDversion = f.readch().charCodeAt(0);
f.close();
return (IDversion);
}
Copy link to clipboard
Copied
---
Copy link to clipboard
Copied
Hi Robert,
I don't think that is correct. It depends what platform the file was created on - Mac or PC. InDesign files are subject to the endianness of the creating platform.
On PC, data is stored in L...H format, on Mac it is stored in H...L format. So if the file originated on a PC, you'd look for four consecutive bytes 05 00 00 00 and for a file that came from a the Mac, the file would contain 00 00 00 05 in those same four bytes.
Try to get hold of a file created on a Mac, and see for yourself...
Cheers,
Kris
Copy link to clipboard
Copied
Kris,
I just checked both Mac and Windows files, and did not see a difference.
The first 30 bytes in every file I checked were:
06 06 ED F5 D8 1D 46 E5 BD 31 EF E7 FE 74 B7 1D
44 4F 43 55 4D 45 4E 54 01 70 0F 00 00 06
(or 05, 04, or whatever)
???
Harbs
Copy link to clipboard
Copied
Oops - correction - that needs to be a PowerPC Mac. Intel Macs have the same endianness as PCs, so they look the same. Try to get hold of a file created on a PowerPC Mac (which has Motorola endianness) - it's different, you'll see.
Cheers,
Kris
Copy link to clipboard
Copied
Ah. That makes much more sense!
Here's the first 36 bytes of a PowerPC file...
06 06 ED F5 D8 1D 46 E5 BD 31 EF E7 FE 74 B7 1D
44 4F 43 55 4D 45 4E 54 02 00 00 0F 70 00 00 00
06 00 00 00
Harbs
Copy link to clipboard
Copied
Thanks to all who replied.
I got the answer by "CreatorToo>Adobe InDesign [3/4/5]".
Regards,
Ramkumar .P
Copy link to clipboard
Copied
Essentially, from position 25 onwards you see two 4-byte longs - 0x00000F70 0x00000006 (or whatever the version is). On Intel-endian machines they are encoded as 70 0F 00 00 - 06 00 00 00, on PowerPC-endian machines they are encoded as 00 00 0F 70 - 00 00 00 06. Unless you're aware of the endianness, the version number will seem to 'shift' position in the file depending on the file's origin.
To do it correctly, you need to read the single byte at position 24. If that byte is a 1, the file is Intel-endian. If that byte is a 2, the file is PowerPC-endian.
Then you need to read 4 bytes from position 29 onwards. Those 4 bytes need to be interpreted depending on the endianness. The resulting 4-byte long is the version number.
Also works for other files (e.g. indb etc...).
Copy link to clipboard
Copied
Thanks for the lesson, Kris,
Endiannees was one of those things that I was always meaning to figure out, but never did...
Harbs
Copy link to clipboard
Copied
Thanks, Kris -- very useful stuff.
Peter
Copy link to clipboard
Copied
RorohikoKris wrote:
on PowerPC-endian machines they are encoded as 00 00 0F 70 - 00 00 00 06. Unless you're aware of the endianness, the version number will seem to 'shift' position in the file depending on the file's origin.
So how come the lists of bytes that Harbs posted for Intel/Windows and PowerPC were identical?
I thought endian-ness didn't matter with 8-bit bytes, but I was with Harbs the day it was taught...
Copy link to clipboard
Copied
They were not.
Byte 25 and on with Intel was: 01 70 0F 00 00 06 00 00 00
While PowerPC it was: 02 00 00 0F 70 00 00 00 06
Harbs
Copy link to clipboard
Copied
It's not the endianness inside single bytes (thank the Silicon Gods for that!).
Everyone can see that 4589 is less than 9341, even though it has the same number of digits, because, well, the first one's rightmost digit is '9' and the second one's is '1' but that doesn't make sense, because it's the leftmost digit that counts most.
You're thinking, "Sure, but what about that endianness thingy?"
It's the same thing. Suppose you get two 2-byte values:
(a) 123 and 85
(b) 86 and 100
Which 2-byte value is the largest? Well, obviously it's the first one, as the most significant part (123) is clearly larger than that of the other (86). Now suppose you have to design a computer chip, and you have to decide in which order to store 2-byte values. It's quite obvious to you, me, and, for example, Motorola engineers, how you would do that: most significant byte first, then least significant.
Unfortunately, the designers of the most prevalent microchip to date, Intel, decided to do it ... the other way around. (Insert appropriate smiley/sad face/horror here). For some reason, they reckoned it useful to store the least significant part first. Remember, back in "the day" when this was decided, using two bytes to store a number was ... well, how golly big numbers do you computer techies want to process!? Two bytes, that's up in the thousands! Imagine!
So I imagine there must have been a highly technical reason for it.
The term "endianness", by the way, comes from Gulliver's Travels -- which, I'm sure, most of you read. Remember the Civil Wars on which end to start eating an egg?
Applying this to the (a) and (b) numbers, when you are asked "what is the bigger two-byte number?", then you ask "Is it Most Significant Byte first, or Least Significant first?" Is it the former, then it's (a); for the latter, it's (b).
10010001
the highest bit value (128) is always on the left, and the lowest (1) is always on the right.
Copy link to clipboard
Copied
Hello Shonky,
Maybe, but he asked "I need to identify the Application Version", not "I need to identify which application version created document x". But we'll see what he says...
Peter
Find more inspiration, events, and resources on the new Adobe Community
Explore Now