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 开发者_如何学PythonCreateObject("InDesign.Application.CS5")
opens InDesign how to close it?
app.quit();
easy as that
app.open
to open
app.quit
to quit
精彩评论