Skip to main content
Participant
April 20, 2010
Question

Cannot Open 'CS3 file in CS2' - programmatically handle this dialog

  • April 20, 2010
  • 2 replies
  • 902 views

I am running a Visual Basic app that cycles through a collection of InDesign documents performing actions. We are using CS2 and the problem occurs when a CS3 document is encountered, which hangs the app. When opening the file manually the following error dialog is encountered:

Cannot open "xxxx.indd". Please upgrade your plug-ins to their latest versions, or upgrade to the lastest version of Adobe InDesign.

InDesign is launched by:

appInDesign = CreateObject("InDesign.Scripting.CS2")

User interaction is suppressed:

appInDesign.ScriptPreferences.UserInteractionLevel = InDesign.idUserInteractionLevels.idNeverInteract

Documents are opened by:

docInDesign = appInDesign.Open(<FilePath>, False)

How do you handle/identify this dialog/error without user interaction (I would like to skip the file)?

Thanks in advance

This topic has been closed for replies.

2 replies

Mac_06
Inspiring
April 21, 2010

Nice Code Shonky

I think this is what you are looking for Martin;

var docInDesign, f;
f = File.openDialog ('Select file', undefined, false);

if (getFileVersion(f) != 4){

alert ("Can not open the file, Indesign Version: is " + getFileVersion(f))
}
else {

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT
docInDesign = app.open(f);
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL
}


function getFileVersion(f){
var IDVersion;
f.open('r')
f.seek(29, 0)
IDversion = f.readch().charCodeAt(0);
f.close();
return (IDversion);
}

Mac

Inspiring
April 20, 2010

If you opening CS3 file in CS2 you alway get error message.

I think best solution is check indesign document version before opening it.

I have code for checking indesign version but it is Javascript code.

But it will give you idea how you can check indesign version and skip that files.

Here below is code:

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); }

Shonky

Participant
April 28, 2010

Thanks for the post but I don't know jscript, it looks like you are opening the file as a textstream and reading the file version there?