This content has been marked as final. Show 5 replies
Why would you need to know?
If you're using AppleScript, it's most likely that the file type/file creator will not have been set on files created in Windows that have never been opened on the Mac OS.
Thanks Ole. Sometimes it is the simplest things that are staring you in the face. Can you help me with one other that I've been having trouble with? How do you tell which version of InDesign a file was created with on a PC?
Hm. That one is harder. I guess my first thought is: you can't. But my second thought is that if it opens as "Untitled," at least you know it wasn't created in the current version. Hope that helps?
I believe an InDesign Template file (.indt) will be opened as "Untitled-#". I think that opening an older file will have "[Converted]" in the document window's title, but the document name will remain the same as the original.
You can find the version of InDesign that created the document by using the metadata preferences property of the document. The "creator" property is the version of InDesign that last saved the document.
At any rate, I think this the following code may get you on the road to doing what you want:
tell application "Adobe InDesign CS3"
-- Assume an opened document
set myDoc to document 1
-- Check to see if myWindowTitle contains "[Converted]". If it
-- does contain "[Converted]", myDoc was probably created in a
-- version of InDesign previous to the version that is running.
-- If the user saves the document with "[Converted]" in
-- its name, you will need to look for "[Converted]" in
-- the window title after the @ and % sign in the window title
-- or by using some other clever means of detection.
set myWindowTitle to (name of window 1 of myDoc as text)
display dialog myWindowTitle
-- Get the creator version of the document.
set myCreatorVersion to (creator of metadata preferences of myDoc as text)
display dialog myCreatorVersion
InDesign writes its version at byte 30 in a document, so reading that gives you the document's creator. That way you can check a document's creator before opening it:
doc = '/d/test/test.indd'
alert (doc + ' was created by InDesign ' + creator ( File (doc)));
function creator (f)
f.open ('r', undefined, undefined);
f.encoding = 'binary';
f.seek (29, 0);
var version = f.readch ();
return version.charCodeAt ()
Peter (thanks to Teus)