Open a data source, close all the panels for it, synchronize with new data, open a new panel, open a document, paginate at guide positions.
To install this script, navigate to the Adobe InDesign Application Directory and paste the script file into the following folder ‘Scripts -> Scripts Panel’. The script can then be run from the Scripts panel; this is found in ‘Window -> Utilities -> Scripts’.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | var datasourceName = "ENTER NAME OF DATA SOURCE HERE"; var templatePath = "ENTER PATH TO TEMPLATE OR DOCUMENT FILE"; var libraryPath = "ENTER PATH TO LIBRARY FILE"; var myEC = app.easycatalogObject; if (myEC == null) { $.writeln("myEC is null"); } myDS = myEC.datasources.item(datasourceName); if (myDS != null) { // close all views for this data source var dvCount = myDS.dataviews.count(); for (index = dvCount-1; index >= 0; index--) { myDS.dataviews.item(index).closeDataView(); } //ensure that the most recent data has been synchronized myDS.synchronizeWithDataSource(); //now use the dataview object to to make selection and do the pagination var myDV = myDS.dataviews.add(); if (myDV != null) { myDV.makeSelection(1,1); myDoc = app.open(File(templatePath), true); if (myDoc != null) { myDV.paginateUsingGuides(myDoc, libraryPath, 1) } else { result =result + ("Error: Unable to open the source InDesign file. " ); myDoc = null; } // end of else part of if (myDoc !=null) myDV.closeDataView() } // end of if part of if (myDV != null) } // end of if part of if (myDS != null) else { $.writeln("unable to open data source"); myDoc = null; myEC = null; } // end of else part of if (myDS != null) |