1 Reply Latest reply on Sep 19, 2014 7:23 PM by RobertKyle

    IDCS6(MAC OSX): script to import styles, master pages, swatches... pitfalls?

    Colin Flashman Adobe Community Professional

      Hello all.

       

      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