Apply an object style

About a year ago, someone helped me create a script that applies a Character Style.
The script is:
try {app.selection[0].appliedCharacterStyle = "Red"} catch(e){}
How do I do a similar thing for an Object Style?

HI
I am not sure if this will get a reply as it is an old thread, but I have tried your method Dave:
myLossenge.appliedObjectStyle = app.documents[0].objectStyles.item("PriceBox");
where there IS an object style called PriceBox, but the style does not get applied.
Any ideas?.....
Just answered it myself, 'myLossenge' is the image that has been placed, 'myLossengeFrame' is what I need to apply the style to.
No need to post this, but may be helpful top others doing the same thing!.
Cheers
Roy

Similar Messages

  • [JS][CS3] Applying an Object Style

    Hi.
    This is a simple one, I am trying to apply an already made Object Style to a text frame.
    I am using a similar method as used to apply a paragraph style:
    myFrame.appliedObjectStyle.name= "GreenBox";
    and also
    myFrame.appliedObjectStyle= "GreenBox";
    But these dont work.
    I have researched the forums and found something like:
    myFrame.applyObjectStyles(GreenBox , true);
    and
    myFrame.applyObjectStyles(GreenBox);
    but these dont work either.
    Can someone give me a hand with the correct syntax please?
    Thanks in advance
    Roy

    void applyObjectStyle (using: ObjectStyle[, clearingOverrides: bool=true][, clearingOverridesThroughRootObjectStyle: bool=false])
    Applies the specified object style.
    Parameter
    Type
    Description
    using
    ObjectStyle
    The object style to apply.
    clearingOverrides
    bool
    If true, clears the Button's existing attributes before applying the style. (Optional) (default: true) (Optional)
    clearingOverridesThroughRootObjectStyle
    bool
    If true, clears attributes and formatting applied to the Button that are not defined in the object style. (Optional) (default: false) (Optional)
    -- so you can use one or even two trues; it's default is 'true'.

  • How to apply an object style based on paragraph style?

    Have a job where a single page with a frame of 3 columns is repeated many times.
    (It is always alone and behind a title page)
    But this system is not very good if the text flows... Formatting is lost.
    Obviously, anchored frames should be a solution but I could prefer apply a text frame definition (just the 3 columns needed) with the menu f/change:
    Thus, my 3 columns page that have a style always will have this frame definition.
    In anchored frames it is default to insert a return to get in the next page?

    Olfarr,
    Yes, it IS the most perfect solution.
    I was trying with the worst method: a text frame + columns, but at the time a new text or a new page appear the text reflows and anything is lost.
    This menu resolved all.
    Thank you.

  • How do I generate a static caption that has an object style applied?

    For instance, I have a photo and have set up a shortcut to generate a static caption. I can apply a paragraph style to it, but I don't see a away to apply an object style that will automatically apply an 11 pt text wrap on the bottom of the text box.

    For instance, I have a photo and have set up a shortcut to generate a static caption. I can apply a paragraph style to it, but I don't see a away to apply an object style that will automatically apply an 11 pt text wrap on the bottom of the text box.

  • [IDCS2] Trouble applying object styles

    I'm trying to apply an object style to a page item but I'm not having any success.<br /><br />I'm using IObjectStylesFacade::ApplyObjectStyleToUIDList to apply the style. <br />The style UID is coming from the IStyleNameTable/IID_IOBJECTSTYLENAMETABLE in the doc workspace using FindByName, the UIDList argument contains a kMultiColumnItemBoss (I needed to navigate down from a kSplineItemBoss to get it... this seems legitimate from the layout chapter in the docs), and I'm getting the K2Vector<ClassID> of categories from IObjStylesAttrCategoriesList::GetApplyCategories (I've tried an empty list as well).<br /><br />ApplyObjectStyleToUIDList returns with kSuccess, but the page item always ends up with the style "None". I've tried a few other things (mostly regarding which page item is passed through the UIDList) but nothing has changed. Is there anything clearly wrong with my approach? I'm doing the same thing in CS3 and haven't had any problems, strangely.

    It looks like I was attempting to apply the style to a kMultiColumnItemBoss. The target should be a kSplineItemBoss. I thought I was doing this originally, but I must've been mistaken since it's working now with that change.

  • Script for applying object style to only tif, or eps or...(by extension)

    We need to apply object style to only eps files in doc, or tif.... How to do this? Maybe someone have a script?
    thanks

    @kajzica – I don't have a script for that, but it is scriptable. You surely mean that you want to apply the object styles to the container frame of the images, aren't you?
    A few minutes later – try the following ExtendScript (JavaScript) code:
    You could edit the names of the two object styles at the beginning of the script code.
    OR: you could first run the script, the script will add two object styles to the document that you can edit afterwards.
    The script will sort the EPS and the TIFs from the other image types.
    Make sure that all graphics are up-to-date and linked correctly!!
    //ApplyObjectStylesTo_ContainersOf_TIF_EPS.jsx
    //Uwe Laubender
    * @@@BUILDINFO@@@ ApplyObjectStylesTo_ContainersOf_TIF_EPS.jsx !Version! Thu Dec 12 2013 13:15:30 GMT+0100
    //Edit your style names here. Change the name between the two " " only!!
    //OR: edit your object styles in InDesign after running the script.
    var styleNameForEPS = "EPS-Containers-Only";
    var styleNameForTIF = "TIF-Containers-Only";
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
    app.doScript(_ApplyObjectStylesToContainers, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT, "Apply object styles to containers for TIF and EPS graphics");
    function _ApplyObjectStylesToContainers(){
    var d=app.documents[0];
    var allGraphicsArray = d.allGraphics;
    if(!d.objectStyles.itemByName(styleNameForEPS).isValid){
        d.objectStyles.add({name:styleNameForEPS});
    if(!d.objectStyles.itemByName(styleNameForTIF).isValid){
        d.objectStyles.add({name:styleNameForTIF});
    for(var n=0;n<allGraphicsArray.length;n++){
        //The EPS case:
        if(allGraphicsArray[n].getElements()[0].constructor.name === "EPS"){
            allGraphicsArray[n].parent.appliedObjectStyle = d.objectStyles.itemByName(styleNameForEPS);
        //The TIF case
        if(allGraphicsArray[n].getElements()[0].constructor.name === "Image" && allGraphicsArray[n].getElements()[0].imageTypeName === "TIFF"){
            allGraphicsArray[n].parent.appliedObjectStyle = d.objectStyles.itemByName(styleNameForTIF);
    }; //END: function _ApplyObjectStylesToContainers()
    Uwe

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

    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?

    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

  • Object Style

    How do I make an object style which generates a fixed size frame (100mmx60mm for e.g.)? And is it possible to then make that box appear at a fixed point on a page? I have tried to create this using object styles and using the anchoring options, but cannot get it to work...

    Sounds more like a case for a library item than an object style (though you can apply an object style when you create the item). Possibly a snippet would be able to make it appear at the fixed location, though I'm not sure about that.

  • 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

  • Duplicating Object Style with Formatted Paragraph and Formatted Rectangle.

    Hey,
    I am trying to duplicate an object style but I am not sure if I set it up correctly.
    I have a rectangle object with strokes and applied fx effects to corners, gradient feather, transparency.
    I also have a text frame where there is a header paragraph format and a drop cap paragraph format for the main text.
    Rather than going through this process again, I thought creating a object style would save time but how do I group these two frames (rectangle shape and text frame) and apply an object style? I am only allowed to apply an object style individually to either the text frame or the rectangle object. It also doesn't help when I try to create a rectangle frame around the previous two items.

    Okay so I try to revise my process and used only one object style. I'm almost there but I'm still running into issues.
    1. I created a text frame and applied two paragraph styles to the text (header and drop cap). 
    2. Next, while selecting the text frame i applied a fill with transparency and corner option effects.
    3. Then with the text frame selected I created an object style and made sure the paragraph style is turned on, with the paragraph style set to "header" and checked the apply next style (so that the drop cap style will be applied as well).
    However, when I finish all these steps and try to apply it to a new text frame without any formatting, it sets all the text to "header" style without applying the dropcap style. I don't get why I can't apply multiple paragraph styles into the object style. I have to manually select the paragraph and apply the drop cap style which changes my default object style to become Object Style 1+ due to override (which is fine but even when I right click and choose redefine style, it does not nothing)

  • [CS3/4, JS] Apply feather using an object style

    I was hoping to apply transparency effects via an object style using this:
    myObjectStyle.objectStyleContentEffectsCategorySettings.enableFeather = true;
    But "Object does not support the property or method..." etc.
    I'd be very grateful if someone could point me in the right direction.
    Thanks in advance -- Jeremy

    Yes, I had got that far by stumbling blindly through the undergrowth, but it still seems to leave feather switched off, according to the Object Styles Panel, and my fumbling attempts to adjust choke, noise, etc. do not seem to have any effect, so I think it really must be switched off. What gave you the impression that that line was successfully switching feather on?
    Partly, my difficulties stem from the fact that I find the Extendscript Toolkit CS4 Object Model Viewer incomprehensible. I mean, take a look at the picture below. What is "Object Model Object Model Object Model Object Model", supposed to mean, and why is every version of InDesign labelled "CS4"?

  • Applying object style to all objects in a project?

    In Cp4, it was possible to change the style of an object and then apply those changes throughout the entire project.
    How is this accomplished in Cp5?
    I have set up a default style for captions but it seems like I can only change the style of individual captions (one at a time) in the properties of each caption.
    Is there a hidden "apply to all" feature in Cp5?
    Thank you

    Hello Lilybiri,
    I really tried to follow your example but it simply did not work for me.
    >Supposing  I already have a lot of Text Captions and decide to change their style,  which can include font,
    >caption style, alignment, colors....
    Yes.
    >All  Text Captions up to that moment did use the Default Caption Style as it  was set in
    >the Object Style Manager...
    >If you want to change object styles for future projects you  have to set them in the
    >Object Style Manager without any project opened.
    This is problem one. I have one standard caption style for all my courses. I have changed the default in the Object Style Manager with and without a project opened. The change simply doesn't stick! Additionally, I have exported a new style to a .cps.
    Let me pick through your instructions:
    1. First, I open a project.
    2. I open the Object Style Manager and notice that the default caption style is back to the original Adobe default (Adobe blue).
    3. I import my new caption style. The style is called NewTextCaptionStyle.
    4. On the first slide, I select the first text caption (in Adobe Blue).
    >I then change one Text Caption  to  the new style and a + sign appears next to the
    >Default Caption Style as you can see in the screenshot.
    How do you come to that?  The moment I go to the first slide and select the first text caption, it already shows: "+[Default Caption Style]" I have not changed the caption style yet. If I select my desired caption style (NewTextCaptionStyle) from the pull down menu, there is no "+" symbol. I cannot follow this step.
    In an attempt to interpret your instructions, I went back to the Object Style Manager and changed the default caption style to what I need.
    Okay, now the [Default Caption Style] is exactly what I require.
    Back at the first slide, I select the first caption (which is still Adobe Blue). Now, I can follow your first step.
    >There are 2 quick ways to proceed now:
    >1. If  you will not use the original Default Caption Style anymore in this  project (it will have no consequences
    >for other projects), use the Save  icon (yellow highlighted) to save the changes and have a new
    >Default  Caption Style that will automatically be applied to all Text Captions  that are already created and
    >new Text Captions will get the same style  too.
    I will follow your first method.
    1. I select the Save icon. [Save Changes to Existing Style]
    ... it doesn't work. ????
    I wonder... the project that I am working with were converted from Cp4 recordings. I wonder if that is causing my grief?

  • CS3: Applying Object styles not always consistent

    Hello,
    I have a number of Object Styles, each of which have different Paragraph Styles called out. In turn, each of these Paragraph Styles calls out different fonts, font styles and sizes.
    Most of the time I can click on a text frame and all the parameters in the Object style are applied--just as it is supposed to be.
    But sometimes the font that the text is supposed to change to does not get applied. This seems to be inconsistent but there is probably an underlying order to it that I do not see.
    So why would an Object style not apply the Paragraph style that is called for in the Object style options?
    Thanks,
    Tom

    I now see the problem, though I do not know the solution.
    If I open up a new document and create a text frame, the font is that old ugly but familiar Times-Roman 12 point.
    But if I open up the template where I have many object, paragraph and character styles, one of each of these is already selected. I can either see this by opening the respective panels or above in the control panel. In fact, any text frame I create always has a top text inset.
    So my Preferences in general are OK and I'd rather not dump them. The problem is that styles are already selected upon opening this one ID file. How do I turn that off?
    In  answer to a question above, I do not simply redo the old Quark file, now in ID. I have a series of styles that are just much easier to apply in a separate ID file, rather than reinventing them in the Quark-to-ID file.
    Thanks for your questions and ideas. They helped me probe this deeper. Now I just need a solution to what I think is a simple problem (still eludes me tho!)
    Tom

  • Applying a graphics style to object in extendscript

    Hi
    I've looked around but can't find anything on this although I'm sure its pretty straightforward.
    How do I apply a graphic style (pre defined in the GRAPHIC STYLES palette as 'Line 1) to an object, say rectangle, called 'rectangle1' using extendscript.
    Can't work this out. (In illustrator CS5 bye the way)
    Thanks
    Bob

    here's a sample, graphic style "add" applied to Selection
    var idoc = app.activeDocument;
    var sel = idoc.selection[0];
    var addStyle = idoc.graphicStyles['add'];
    addStyle.applyTo (sel);

  • Apply "Script Labels" to Object Styles?

    Hi again,
    I think I've kind of found a solution to my previous thread. But it involves using Script Labels in order to get it to work. Problem is I've tonnes of text boxes with Object Styles applied that don't have any Script Labels applied to them. Is there a way I can apply a script label to all of my existing text frames that have a particular Object Style already applied to them?
    Thanks in advance.

    You could use essentially the same script I just posted but set the label rather than the itemLayer of each found object. However, it seems like a convoluted approach.
    Dave

Maybe you are looking for

  • How to add an image in a hub section header

    Hi. I want to add an Image in a hub section header. Is it possible to add an image with the section header so that like the section header when I click on the image it would also navigate me to that section page ? samEE

  • How to get hostname of a remote computer by ip

    how to get hostname of a remote computer by ip

  • How do I save my ratings onto another comuter???

    I have a new lap top and managed to move my library over but lost my ratings for all my songs and don't want to do it all over again. I still have the old lap top for the moment. Thanks so much for helping!

  • Domino 7 Provisioning

    Hi, I am configuring domino server from Sun identity manager. After enetering the information in the resource wizard, i test the test connection.That works fine. Now configuring domino 1)Created an admin user. 2)Add the user to the access control lis

  • Removing listeners?

    Hi team, Is it always best practice to remove every listener that you create in a project? I thought I had this worked out but all of a sudden I am getting errors by trying to use the removed from stage listener. So there are buttons on the stage and