Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

[JS] Open document without showing window

Mentor ,
Dec 31, 2014 Dec 31, 2014

Hi there, wise scripters,

Win7 64-bit, CS6, ID8.0.2

I need to open indd doc, process some code, close file. Everything works fine.

However, the 'open' method has a parameter [showingWindow], right?

To speed things up a bit, I try to turn off displaying document's window by using the 'false' argument while opening the file, like this:

var file = File.openDialog(); 

app.open(file, false);

... and can't get it to work. File just won't open then.

Found a few posts where people say it's working just fine for them.

What I am missing / doing wrong?

Thank You!

P.S. Funny thing is, a couple of years ago, playing with 'save', 'save as', and 'save a copy' options, I had achieved this effect unintentionally, in some quite different way I can't recall now...

TOPICS
Scripting
2.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 31, 2014 Dec 31, 2014

var file = File.openDialog();

app.open(file, false);

These lines are working fine for me.

Check the target application in ExtendScript it should be 'Adobe Indesign CS6'

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Dec 31, 2014 Dec 31, 2014
LATEST

Hi,

Well, I see now, my problem is a bit different...

This is initial basic working code sample:

var file = File.openDialog();

app.open(file);

app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;

app.pdfExportPreferences.viewPDF = false;

app.activeDocument.exportFile(ExportFormat.pdfType, File("C:/Folder/Test.pdf"), false, "myPDFpreset");

app.activeDocument.close(SaveOptions.NO);

alert("Done");

Now I realized I can't simply add 'false' argument to app.open(file, false) - script throws an error 'No documents are open'.

And this works as expected (not showing window):

var file = File.openDialog();

var myDoc = app.open(file, false);

app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;

app.pdfExportPreferences.viewPDF = false;

myDoc.exportFile(ExportFormat.pdfType, File("C:/Folder/Test.pdf"), false, "myPDFpreset");

myDoc.close(SaveOptions.NO);

alert("Done");

So I would need to modify the main code - that's too bad... I was hoping to use this in a much more complex script, with a lot of lines, doing a big bunch of things...

However, thank You for your response and have a nice party tonight

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines