Search Object Style in CS2

Hi all,
Im doing javascript for InDesign CS2. I need to find unused Object style through script.
Please Help....
Thanks in advance...

Hi creativejoan0425
I am not sure if I get your question rigth because my answer ist very short
All you need is:
var myDocAnz = app.documents.length;
for (k= 0; k < myDocAnz; k++) {
     var myStories = app.documents[k].stories.everyItem().getElements();
// your code
     for (i = myStories.length - 1; i >= 0; i--){
         var myTextFrames = myStories[i].textContainers;
         for (j = myTextFrames.length - 1; j >= 0; j--)    {
             if (myTextFrames[j].contents == ""){
                 myTextFrames[j].remove();
             } // if
         }  // for
     } // for
} // for
But with this script you remove every empty textframe
Kind Regards
Dani (from Switzerland)

Similar Messages

  • Nested styles in CS2. Absence of property appliedNestedStyle

    In task I'm working on there is a subtask of extracting overrides from the text.
    The way I implement it is pretty straightforward: I iterate through all textStyleRanges. With each textStyleRange object I compare its style properties with style properties of paragraphStyle and characterStyle that are applied to it.
    Things are getting harder when nested styles come into play.
    When they are applied, they should be taken into account along with appliedParagraphStyle and appliedCharacterStyle.
    This issue also affects Drop Caps. When the character style is applied to Drop Cap this character style becomes nested.
    In CS3 scripting objects (textStyleRange, text, etc) has property appliedNestedStyle. So to extract overrides I can use it.
    But in InDesign CS2 there is no such property...
    So the question is how can I get applied nested style in CS2? Or maybe some workaround to accomplish the same goal?

    Indexes
    Scripting indexes has changed a lot. It finally works, and it works well. The property 'subtopic' has gone, instead you iterate the property 'topic' (up to three times). The following lines illustrate:
    if( app.activeDocument.indexes.length == 0 )
    myIndex = app.activeDocument.indexes.add()
    else
    myIndex = app.activeDocument.indexes[0]
    //create main topic
    myIndex.topics.add('dog')
    //create subtopics
    myIndex.topics.item('dog').topics.add('collie')
    myIndex.topics.item('dog').topics.add('setter')
    myIndex.topics.item('dog').topics.item('collie').topics.add('border collie')
    myIndex.topics.item('dog').topics.item('collie').topics.item('border collie').topics.add('*****')
    You can address (sub)topics by asking for topics embedded under topics:
    myIndex.topics[0].topics[0].topics[0].topics[0].name
    is the first subtopic of the first subtopic of the first subtopic of the first topic.
    A new property is allTopics: myIndex.allTopics returns an array of all (sub)topics. This is a flat, one-dimensional, array, i.e. it returns the whole index but without structure.

  • Setting the default object style or stroke weight of a document

    i can select items and apply created object styles, but i want to change a documents defaults BEFORE i create something?
    backgorund - i need to add my logo to the bleed area of my document but i find that if a document has a default of say 5pt stroke weight then it fails when trying to draw my logo before I have a chance to change it saying
    "Adobe InDesign CS2 got an error: Requested operation would cause one or more objects to be too small.
    Please check whether the stroke weight is too large."

    Could you be please more precise ?
    If I got the idea, you want to place everytime your logo in the bleed area.
    I will first set the bleed area with these instructions :
    app.activeDocument.documentPreferences.documentBleedUniformSize = true;
    app.activeDocument.documentPreferences.documentBleedTopOffset = 5;
    then i will create a rectangle at the point -5,-5
    var myframe = app.activeDocument.rectangles .add({geometricBounds:["-5","-5","0","25"]});
    //dimensions are what you want
    then place the logo.
    var myfile = File("logo");
    //logo is a filepath "/c/..."
    myframe.place(myfile);
    Here you are,
    A+ Loic

  • Problem loading styles from CS2 to CS4

    I just upgraded to InDesign CS4. When I open a file I created in CS2, none of the object styles I defined in that document are available. I tried to load the object styles from CS4 (pointing to the CS2 file that contains the styles), but it brings only 1 of about 15 styles across. In addition, the only style that comes across is now grayed out, so I can't apply it anyway. Has anyone else had this happen?
    Thanks.
    Brian

    Personally,I don't think is a strange question, mainly because I will be in the same position soon. If I understand correctly, you are concerned that you wont be able to install CS4 64bit if you have to install CS2 first. Is that correct?
    If so, I'm in the same boat. I assume that it will be possible as it is possible to run CS2 in 64bit mode.

  • Find element by object styles  and copy it

    Hello, I would like to create a script.
    Find element by object styles :
    Outside of document, I create on block with the object style "reference". This will be unique.
    After selected, I want to put it on CLIPBOARD or just do a copy.
    If selected by object styles isn't possible, how i can make a id on my element?
    Can you help me?
    Thancks a lot!

    Thank a lot!
    So, I have a find/change with a grep code.
    I copy an element, and I launch the search. My requete says "when you find this, paste".
    I use a javascript which do all my find/change like this :
    var myTextFrame = app.selection[0];
    var myStory = myTextFrame.parentStory;
    app.loadFindChangeQuery ('PuceSimple_enPuceCouleur_Courant', SearchModes.grepSearch);
    myStory.changeGrep();
    This work very well, so If I select my element, I copy, I select my texframe, I run the script all is OK.
    But I would like that script do this :
    I select my texframe and run my script : it copy element (it find by label or object style) and run the find/change grep.
    I put it some shots :
    1 : you see that my element is selected, it has a object style name, a label name. I think that it will be outside the page. I copy it.
    2. I run the find/change
    3 it's work !
    Do you understant what I want to do in scripting ?

  • How to find Object Styles

    Hello,
    Adobes Scripting Guide: JavaScript explains well(more or less) how to find text, greps and glyph. But lacking is how to find Object Styles. The Find/Change Dialog box in ID does have this option.
    What I would like is a script that will find a style, then fill in the color of that style so that one can clearly see in a long document where the style was used. When there are only subtle differences between styles, this is helpful.
    The first thing to do is to clear all the options and that is my first stumbling block. In the following code the first line works, clearing the find of any parameters. The second line does not work.
    app.findObjectPreferences = NothingEnum.nothing;
    app.findChangeObjectOptions = NothingEnum.nothing;
    I also need to set the Search for Documents (not All Documents nor Selection) and to set the Type for All Frames.
    The second obstacle is setting the Find so that it will find the object I am looking for. The code below does not work but I do not know why.
    app.findObjectPreferences.getElements("Object Style 1");
    Any help is appreciated.
    Tom

    You need this:
    app.findObjectPreferences = null;
    app.findObjectPreferences.appliedObjectStyles = "Object Style 1";
    found_objects = app.activeDocument.findObject();
    Some things are different in scripting compared to the interface. For instance, the scope of the search in the interface is just "document" or "all documents", but in a script you can search a page, a spread, almost anything (I have to say that this is true for text and grep searches, I never tried it for objects). Finding frame types is different as well: there's no parameter for that I don't think. Instead, you have to find all frames that have a particular object style applied to them, then cycle through them checking their frame type; if the type matches your criteria, do what you want with it.
    Peter

  • Is there a way to set an outer glow size to % to crete an object style?

    Hi, i have an effect that (an outer glow) and now it's perfect on my graphic that is 1 in X 1.5 in. Except that i will need to have multiple version of this grahic at different sizes, i want to know if there is a way to create an object style taht will make the same effect if i have different graphics at different sizes (without having to import the graphic at the same size and then scale it).
    Thanks!

    The only way I know to scale an effect with the art in ID is if the art is linked. You could do this with an Illustrator file, for example, or make the art in ID as a separate file, then place it into another document and scale.

  • Can you set object style to Fit to Content?

    Hi all,
    I'm setting up a document for an exhibition showguide and before I get too bogged down, I could do with some help.
    Each exhibitor gets a text entry, with a logo alongside. There will be a few hundred exhibitors in total.
    To make things as easy as possible (I hope) I've made a anchored image frame to hold the logos (40mm wide x 40mm tall), which is anchored to the Company Name. This should mean that the logo stays with the correct entry at all times.
    Once I've put my text in, I will have a couple of hundred empty image frames into which I can drag and drop the logos. I've set the 'Fitting on Empty Frame' to Fit Content Proportionally so that the logos all fit nicely.
    The problem is that, after I have placed all the logos into the document, I want to make all the anchored logo frames change from Fit Content Proportionally, to FIt Frame to Content, so that the frame will shrink around any logos that are less than 40mm tall.
    I can't find a way of doing this.
    Is there a way to select all anchored objects, so that I can change the Fit setting in one hit?
    Or, is there a way to set the object style to Fit Frame to Content?
    I feel that I should be able to automate this, but the process/solution is eluding me.
    Cheers
    Colin

    As far as I know, the only way to do this would be by script after the images have all been placed. You should ask over in scripting.

  • Handling and creation of search objects?

    Hi,
    I added five custom fields with the Application Enhancement Tool of SAP CRM ABAP 7.0:
    - distributor1
    - distributor2
    - distributor3
    - distributor4
    - distributor5
    Now I want the search to search in all of these five fields. The problem is, that only one Distributor search criteria field should appear in the search view.
    The Application Enhancement Tool added the five fields automatically as attributes to a dynamic search object.
    To solve this problem I would like to modify the search objects BADI? Any suggestions?
    Thanks a lot.
    Kind regards
    Daniel

    Hey Harshit,
    because the five custom fields should be displayed in an assignment set and the user should be able to fill all of them. So there have to be five fields.
    Hope you can help with implementing a BADI.
    Regards
    Daniel

  • How to create an object style with repeating formatting?

    I am trying to create an object style that will create my subhead formatting after each body of text; in other words, I'll have 5 or 6 subheads, all in need of the same formatting, but they will be separated by bodies of text with multiple paragraphs. How do I go about specifying this repeating formatting in an object style?

    Unless the number of paragraphs between headings is always the same, and always needs the same formatting, you can't.

  • Best-practice for use of object styles to manage image text wrap issues when aiming at both print and EPUB output?

    I have a work-flow question about object styles, text-wrap, and preparing a long document with lots of images for dual print/EPUB output in InDesign CC 2014.
    I am sort of experienced with InDesign but new to EPUB export. I have hundreds of pages and hundreds of images so I'd like to make my EPUB learning curve, in particular, less painful.
    Let me talk you through what I'm planning and you tell me if it's stupid.
    It's kind of a storybook-look I'm going for. Single column of text (6" by 9" page) with lots of small-to-medium images on the page (one or two images per page), and the text flowing around, sometimes right, sometimes left. Sometimes around the bounding box, sometimes following the edges of the images. So in each case I'm looking to tweak image size and placement and wrap settings so that the image is as close to the relevant text as possible and the layout isn't all wonky. Lovely print page the goal. Lots of fussy trade-offs and deciding what looks best. Inevitably, this will entail local overrides of paragraph styles. So what I want to do, I guess, is get the images as closely placed as possible, before I do any of that overriding. Then I divide my production line.
    1) I set aside the uniformly-styled doc for later EPUB export. (This is wise, right? Start for EPUB export with a doc with pristine styles?)
    2) With the EPUB-bound version set aside, I finish preparing the print side, making all my little tweaks. So many pages, so many images. So many little nudges. If I go back and nudge something at the beginning everything shifts a little. It's broken up into lots of separate stories, but still ... there is no way to make this non-tedious. But what is best practice? I'm basically just doing it by hand, eyeballing it and dropping an inline anchor to some close bit of text in case of some storm, i.e. if there's a major text change my image will still be almost where it belongs. Try to get the early bits right so that I don't have to go back and change them and then mess up stuff later. Object styles don't really help me with that. Do they? I haven't found a good use for them at this stage (Obviously if I had to draw a pink line around each image, or whatever, I'd use object styles for that.)
    Now let me shift back to EPUB. Clearly I need object styles to prepare for export. I'm planning to make a left float style and a right float style and a couple of others for other cases. And I'm basically going to go through the whole doc selecting each image and styling it in whatever way seems likeliest. At this point I will change the inline anchors to above line or custom, since I'm told EPUB doesn't like the inline ones.
    I guess maybe it comes down to this. I realize I have to use object styles for images for EPUB, but for print, manual placement - to make it look just right - and an inline anchor seems best? I sort of feel like if I'm going to bother to use object styles for EPUB I should also use them for print, but maybe that's just not necessary? It feels inefficient to make so many inline anchors and then trade them for a custom thing just for EPUB. But two different outputs means two different workflows. Sometimes you just have to do it twice.
    Does this make sense? What am I missing, before I waste dozens of hours doing it wrong?

    I've moved your question to the InDesign EPUB forum for best results.

  • How to change Anchor Object Options Status of Object Styles?

    hi to all,
    here i'm creating Object Style and applying some properties, when i create a Object Style, and the anchor Object options not become true status instead it being in false status how do i change status of anchor Object options of object styles
    pls help me
    here the i tried code,....
      myAnchorFrame.contents =selItem;
         try{
         var rightObjStyle = app.activeDocument.objectStyles.add({name: "RightAlignment"});
         with(rightObjStyle.anchoredObjectSettings)
          spineRelative = false;
          anchoredPosition=AnchorPosition.anchored;
          anchorPoint = AnchorPoint.LEFT_CENTER_ANCHOR;
          horizontalAlignment = HorizontalAlignment.RIGHT_ALIGN;
          horizontalReferencePoint = AnchoredRelativeTo.COLUMN_EDGE;     
          anchorXoffset = spaceVal;
          verticalReferencePoint = VerticallyRelativeTo.lineBaseline;
         }}catch(e){
           myCharacterStyle = app.activeDocument.objectStyles.item("RightAlignment");
           myCharacterStyle.anchoredObjectSettings.anchorXoffset= spaceVal;
          try{
         var leftObjStyle = app.activeDocument.objectStyles.add({name: "LeftAlignment"});
         with(leftObjStyle.anchoredObjectSettings)
          spineRelative = false;
          anchoredPosition=AnchorPosition.anchored;
          anchorPoint = AnchorPoint.RIGHT_CENTER_ANCHOR;
          horizontalAlignment = HorizontalAlignment.LEFT_ALIGN;
          horizontalReferencePoint = AnchoredRelativeTo.COLUMN_EDGE;     
          anchorXoffset = spaceVal;
          verticalReferencePoint = VerticallyRelativeTo.lineBaseline;
         }}catch(e){
           myCharacterStyle = myDocument.objectStyles.item("LeftAlignment");
           myCharacterStyle.anchoredObjectSettings.anchorXoffset= spaceVal;
          try{
         var L_RObjStyle = app.activeDocument.objectStyles.add({name: "L/RAlignment"});
         with(L_RObjStyle .anchoredObjectSettings)
          spineRelative =true;
          anchoredPosition=AnchorPosition.anchored;
          anchorPoint = AnchorPoint.LEFT_CENTER_ANCHOR;
          horizontalAlignment = HorizontalAlignment.LEFT_ALIGN;
          horizontalReferencePoint = AnchoredRelativeTo.COLUMN_EDGE;     
          anchorXoffset = spaceVal;
          verticalReferencePoint = VerticallyRelativeTo.lineBaseline;
         }}catch(e){
           myCharacterStyle = myDocument.objectStyles.item("L/RAlignment");
           myCharacterStyle.anchoredObjectSettings.anchorXoffset= spaceVal;
          if(align =="Left")
           myAnchorFrame.applyObjectStyle(app.documents[0].objectStyles.item("LeftAlignment"), true);
          else if (align =="Right")
           myAnchorFrame.applyObjectStyle(app.documents[0].objectStyles.item("RightAlignment"), true);
          else if(align =="Left/Right")
           myAnchorFrame.applyObjectStyle(app.documents[0].objectStyles.item("L/RAlignment"), true);

    Is it the:
       enableAnchoredObjectOptions = true;
    As shown here: http://forums.adobe.com/thread/454988?tstart=30

  • Dynamic Search Object for Payment Terms

    Hi,
    May i know the Dynamic Search Object for Payment Terms. I have to create a Advanced Search Page with Payment terms. I could not find the dynamic search object for Payment terms. Any help is appreciated
    Thank you.
    -Siddharth

    Hi,
      The search help for the payment terms is not coming from the DDIC search help..
      It is coded in the process on value-request event...
      The function module FI_F4_ZTERM is called for this..you have to change this function module in case if you want the values from a different table..
      OR do implicit enhancement in the subroutine FORM HELP_ZTERM in the include MF02DFH0 to call your search help instead of the function module FI_F4_ZTERM ..And do the same for the sales order also..
    Thanks
    Naren

  • Frame fitting options in object styles

    We are producing multiple pages using tagged templates and importing xml - to populate both text and images.
    Back in CS3 - our object styles using frame fitting worked perfectly. Since we have upgraded to CS5 and now CS6 - when xml is imported the frame fitting element of our object styles are no longer being honoured - when clicking on the object frame, it shows the style has been applied but with overrides - and it is adding random offsets to the frame fitting crop settings.
    We are producing large numbers of pages through xml automation, therefore it's very time consuming to open every page and clear overrides/reset frame fitting on every affected graphic.
    I've seen on other questions/forums that this may be a known bug - anyone have any up-to-date info on fixes or workarounds?
    Thanks for your help :-)

    Hello,
    We have a free startup script that clears the overrides after a place action.
    http://www.kerntiff.co.uk/free-stuff/afterplaceobjectreseter
    P.

  • How to find un used Object styles in a indesign document?

    hi,
    I need to remove unUsed Objects Styles.
    How do i find out?
    How to remove it?
    by,
    Subha

    As far as I can tell, you need to get an array of all the styles you are using, then compare it to the available styles and remove those that don't match up. I did something similar for swatches and changed it for object styles, but I am curious if there is a better way now or in the future. The following code compares and removes used and available styles based on the indexes, ignoring default styles in brackets... but hopefully someone has a more efficient way.<br /><br />jerrod<br /><br />//try this<br />var usedStyles = new Array();<br />for(var x=0;x<yourDoc.allPageItems.length;x++){<br />  usedStyles.push(yourDoc.allPageItems[x].appliedObjectStyle.index);<br /><br />}<br /><br />usedStyles.sort(compareNumbers);<br />var currentIndex = yourDoc.objectStyles.length-1;<br />for(x=usedStyles.length-1;x>-1;x--){<br />  while(currentIndex>usedStyles[x]){<br />    try{<br />      if(yourDoc.objectStyles[currentIndex].name.charAt(0)!="["){<br />        yourDoc.objectStyles[currentIndex].remove();<br />      }<br />    }finally{<br />      currentIndex--;<br />    }<br />  }<br />  currentIndex=usedStyles[x]-1;<br />}<br /><br />function compareNumbers(a, b) {<br />  return a - b<br />}

Maybe you are looking for

  • ALV export to Excel, some field lose char

    Dear SAP, when I develop a report have one field is PR NO(BANFN), and show result in ALV, then user download the report to excel, but the PR# lose the last number, I don't know how to solve this problem, Please help! Ivan

  • [solved] changed owner of /usr /etc /var folders ..

    Hello There ! I messed up, as being the root user, did a chown -R root /usr /var /etc I'm using KDE 4.2, and I bet I messed up with the system. How can I recover this ? I cannot start up kde from KDM, just dont know how can I make it work. I reinstal

  • Problem in BPEL Developer Prompt

    HI , I am getting some problem while I am trying to run BPEL -> Developer Prompt. I am not able to run this Developer Prompt . I reinstalled the product and I checked again .. the problem persists . Anyone pls help me out . Thanks Prashant

  • Visual Studio Designer's property setting window

    How do I bring up the Visual Studio Designer's property setting window? I started WPF Application but the design with XAML code is too tedious. I want to set properties of controls with property window, not code. I can't see property setting window i

  • What is the equivalent of a PST file in Entourage?

    I am new to Mac and not very familiar with Entourage.  I love PST files in Outlook because I like to store emails.  How can I do this using Entourage?