Copy link to clipboard
Copied
Hi
I'm new to scripting, but i have managed to patch together this script. (Much thanks to tips from people at this forum (Green4ever: snippetexport and tomaxxi: grouping).
The script exports every item (asset) in a library to individual snippet files. The files get their names from the library items. Does anyone know if its possible to export the snippets whithout grouping it?
myLibrary = app.libraries[0];
myLibraryPanel = myLibrary.associatedPanel;
for( i = 0; i < app.libraries[0].assets.length; i++ ){
var myObj = app.libraries[0].assets.placeAsset(app.documents[0])[0];
var myName = app.libraries[0].assets.name
var myGroup = new Array();
myGroup = app.activeWindow.activeSpread.pageItems;
if (app.activeWindow.activeSpread.pageItems.length >1){
app.activeWindow.activeSpread.groups.add(myGroup);
var obj = app.activeWindow.activeSpread.pageItems.everyItem();
obj.exportFile(ExportFormat.INDESIGN_SNIPPET, File("/path/"+ myName + ".idms"));
obj.remove(0);
}
else { }
var obj = app.activeWindow.activeSpread.pageItems.everyItem();
obj.exportFile(ExportFormat.INDESIGN_SNIPPET, File("/path/"+ myName + ".idms"));
obj.remove(0);
}
Copy link to clipboard
Copied
Hi,
eportFile-method is assigned to single Page items, so as far as I know, there's no way around grouping here ...
Copy link to clipboard
Copied
Ok. Thank you!
Trond
Copy link to clipboard
Copied
This is something i have been wanting to do for a long time, but I can't get your script to work.
Should this work in CS4
Don't surpose you could post someplace the actual script
Copy link to clipboard
Copied
Hi
This is the actual script and it works in CS4. You have to have a document and the library open.
Trond