Skip to main content
Known Participant
July 23, 2010
Answered

Opening an .indt file from InDesign

  • July 23, 2010
  • 2 replies
  • 3680 views

I'm trying to open a .indt file, when running the script from InDesign.

So far I've only been able to do so when running the script from the ExtendScript Toolkit with the following code:

var path="test/test.indt"

myFile = File (path);

myFile.execute();

However, when I run the script from InDesign, nothing happens. I've also tried the following version:

var path="test/test.indt"

myFile = File (path);

myFile.open();

This did not work either.

Please help me out.

This topic has been closed for replies.
Correct answer Kasyan Servetsky

var theFile = new File("~/Desktop/Test.indt");
var doc = app.open(theFile);

2 replies

BarqxAuthor
Known Participant
July 25, 2010

Thanks.

I tried that. It still does not open the file when running the script from InDesign.

Any other options?

Peter Kahrel
Community Expert
Community Expert
July 25, 2010

> var path="test/test.indt"

Try with an absolute or full path, i.e. including the drive, such as var path = "/d/test/test.indt". You used a relative path, so the OS looks for your folder/file in whatever it thinks is the current folder.

Peter

Inspiring
July 28, 2010

Hi try the following code. It will work

var FilePath = Folder.decode(C:/Package/);  //where "C:/Package/" is the folder location

var FileName = File.decode(a.indd); //where a.indd is the indd file name

var fileLocation = FilePath + FileName;

app.open(File(fileLocation));

Kasyan Servetsky
Kasyan ServetskyCorrect answer
Legend
July 23, 2010

var theFile = new File("~/Desktop/Test.indt");
var doc = app.open(theFile);