InDesign Scripting how to quit application (not document)
Asked Answered
M

1

0

I'm trying to automate data merge process. Here's what I have:

First of all have created a working datamerge script:

function main(){
    mySnippet ();
    myTeardown();
}
//<setup>
//<snippet>
function mySnippet(){
// automate datamerge
var myDocument = app.open(File("P:/RxCut/In Design Implementation/build/automate/automate.indd"));
var myDataSource = File("P:/RxCut/In Design Implementation/build/automate/automate.txt");


myDocument.dataMergeProperties.selectDataSource(myDataSource);
myDocument.dataMergeProperties.mergeRecords();
myDocument=myDocument.save("P:/RxCut/In Design Implementation/build/automate/AutomatedMerged.indd");
app.activeDocument.save(new File("P:/RxCut/In Design Implementation/build/automate/AutomatedMerged2.indd"));
myDocument.close();
}


//</snippet>
//<teardown>
function myTeardown(){
}

This runs great as expected!

Then had to write a vbscript to open InDesign and run that jsx script above:

Set myInDesign = CreateObject("InDesign.Application.CS5")
Msgbox("This message from Vbscript")

myJavaScript = "C:\test2.jsx"

myInDesign.DoScript myJavaScript, 1246973031

Now if CreateObject("InDesign.Application.CS5") opens InDesign how to close it?

Mansoor answered 29/9, 2011 at 19:59 Comment(1)
according to Indesign Scripting Reference CS2's Application object had a Quit method. Have you tried that? (ie myInDesign.Quit)Contagious
M
3
app.quit();

easy as that

app.open

to open

app.quit 

to quit

Mansoor answered 29/9, 2011 at 20:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.