2 Replies Latest reply on Mar 28, 2008 6:48 PM by KeithGilbert

    [JS CS3] JS method for Object Styles > Break Link to Style

    KeithGilbert Level 1
      I have pages full of objects that are assigned the pesky "Basic Graphics Frame" object style. I need to do the equivalent of choosing "Break Link to Style" in the Object Styles panel on all the objects in many files.

      I haven't been able to find anything equivalent to the "Break Link to Style" functionality in looking through the Object Browser. Finding all objects with [Basic Graphics Frame] object style and applying an object style of [None] doesn't do the same result. Any ideas?
        • 1. Re: [JS CS3] JS method for Object Styles > Break Link to Style
          Level 1
          hi:

          //FindObjectPreference
          myDoc = app.documents[0];
          app.findObjectPreferences = NothingEnum.nothing;
          app.changeObjectPreferences = NothingEnum.nothing;
          app.findChangeObjectOptions.properties =
          {
            objectType: ObjectTypes.allFramesType, //graphicFramesType, textFramesType, unassignedFramesType
            includeFootnotes: true,
            includeHiddenLayers: true,
            includeLockedLayersForFind: true,
            includeLockedStoriesForFind: true,
            includeMasterPages:true
          };

          //var graphicOStyleName = "[Normal Graphics Frame]";
          app.findObjectPreferences.appliedObjectStyles = myDoc.objectStyles.item(1);

          var dstStyle = myDoc.objectStyles.item(0);
          var founds = myDoc.findObject(0);
          var foundsLen = founds.length, i, found;
          for(i = 0; foundsLen > i ; i++){
            //app.select(founds[i]); alert(founds[i].appliedObjectStyle.name);
            founds[i].applyObjectStyle(dstStyle, false, false);
          }

          <pre>

          jxswm
          • 2. Re: [JS CS3] JS method for Object Styles > Break Link to Style
            KeithGilbert Level 1
            Thank you. This gets me going in the right direction!