I've recently had a project where I've had to reformat old quark files into new indesign templates, and had a boring process of taking the quark files (that were converted to indd using the markzware plugin) and applying master pages, all the styles used, and all of the swatches used... manually.
Before I begin, I'm not asking for a script!!! I've cobbled one together that was largely inspired by Marijan Tompa (Tomaxxi): Import Styles from file | IndiSnip [InDesign® Snippets]
The difference is that this script only has an "open file" UI, and takes in many changes at once (all feasible styles, colors and master pages). For safety's sake, if there are any clashes with styles or master pages identically named in the new file, it will not load the new versions, but that can all be changed via the Global Clash Resolution Strategy.
var files = "InDesign:*.indd, All files:*.*"; sourceFile = File.openDialog("select the file", files, false); var myDoc = app.activeDocument myDoc.loadSwatches(sourceFile) myDoc.importStyles(ImportFormat.TEXT_STYLES_FORMAT, sourceFile, GlobalClashResolutionStrategy.DO_NOT_LOAD_THE_STYLE); myDoc.importStyles(ImportFormat.TOC_STYLES_FORMAT, sourceFile, GlobalClashResolutionStrategy.DO_NOT_LOAD_THE_STYLE); myDoc.importStyles(ImportFormat.OBJECT_STYLES_FORMAT, sourceFile, GlobalClashResolutionStrategy.DO_NOT_LOAD_THE_STYLE); myDoc.importStyles(ImportFormat.STROKE_STYLES_FORMAT, sourceFile, GlobalClashResolutionStrategy.DO_NOT_LOAD_THE_STYLE); myDoc.importStyles(ImportFormat.TABLE_AND_CELL_STYLES_FORMAT, sourceFile, GlobalClashResolutionStrategy.DO_NOT_LOAD_THE_STYLE); myDoc.loadMasters(sourceFile, GlobalClashResolutionStrategyForMasterPage.LOAD_ALL_WITH_RENAME);
However, I thought others might find this script useful, but was wondering what other scripters here could see that a novice like me would miss (i.e. unexpected issyues, better way of writing the code, taking it one step further, etc).
Colin: One thing to think about is that loadSwatches has no built-in clash resolution. So if you have "Crimson" in both the source file and the target file, you send up with "Crimson" and "Crimson(2)" in the target file.
If that's a problem for you, I can post a snippet that I use to make sure I end up with one Crimson that uses the color values from the source file.