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

Similar Messages

  • Is there a script for applying a certain style to several thousands of words arranged in a list?

    Hello, I have tried using FindChangeByList, but I'd pretty much do all the work of pasting every word on the brackets, so i could as well apply the styles by hand.
    So my project involves applying the same style to around 11 thousand words that appear in a book. Those words are mostly names and brands, and they appear throughout the whole text, so applying that style manually would be quite time-consuming.
    I have those words set aside in a list.txt
    Does anyone know if I could use that in any script and apply the style automatically?
    Like I said, pasting every single word into FindChangeByList is out of the question, just like applying the style word by word, it would take forever...
    ...thanks!

    Okay, for anyone that might be interested in this as I was, I found a solution.
    If you want to have a particular text expression on your .txt list to be used as a search parameter by your script, here are a few tips:
    Let's say you want to add the following 2 expressions on your list, without the quotation marks:
    a) "test, test."
    b)"[test] {test}"
    1 - Like Jongware said, you MUST abide by GREP syntax.
    2 - If you want to put an expression on your .txt list that DOES NOT uses characters that represent GREP syntax (example a) with regular text, commas and simple punctuation), you may simply add them to your list between parentheses:
         a) (test, test.)
    3 - If you want the script to search for an expression that DOES CONTAIN characters that are also used by GREP syntax (example b) you can try stuff like:
         b) (\p{Ps}test\p{Pe})
         note the parentheses, because it's a specific text expression
         then note the \p{Ps} and \p{Pe} that mark opening or (s)tarting and closing or (e)nding punctuation such as brackets, braces, parentheses...
    Here is a file with the GREP expressions that helped me solve my problems:
    http://www.kahrel.plus.com/indesign/grep_mapper.pdf
    Although this is a very specific matter and probably easily solvable by all the professional scripters here, I thought I'd share it since it took 3 whole days of studying for me to conclude everything.
    Thanks again, specially to Jongware

  • Find inline objects and apply object styles...

    Hi Eveyone,
    I am trying to find placed inline rules and apply object styles through javascript. Because we need some baseline shift to those rules. I getting some error while find the rules. FInd the syntax below,
    app.findObjectPreferences=app.changeObjectPreferences=null;
    app.findChangeObjectOptions.properties =
      objectType: ObjectTypes.unassignedFramesType
    app.findObjectPreferences.strokeWeight=1;
    app.changeObjectPreferences.appliedObjectStyles=app.activeDocument.objectStyles.item("WOL" );
    app.activeDocument.item(0).changeObject();
    Can anyone look into this help for me. Thanks in advance.
    Regards
    Thiyagu

    Hi Dave,
    I have tried the script after removing "s" in it. Now i am getting error like "object doesn't support the property or method 'appliedObjectStyle'". Please look into this and help me out. Herewith i attached the 'error' dialog snapshot.
    When i tried this in loop its working fine. Find the script below.
    app.findObjectPreferences=app.changeObjectPreferences=null;
    app.findChangeObjectOptions.properties =
      objectType: ObjectTypes.unassignedFramesType
    app.findObjectPreferences.strokeWeight=1;
    myFindObj=app.findObject(true);
    for(i=0;i<myFindObj.length;i++){
        myFindObj[i].appliedObjectStyle=app.activeDocument.objectStyles.item("WOL");
    alert ("DONE!");
    Regards
    Thiyagu

  • How to call hr_location_api.create_location for different address style with only those fields that belongs specific to  that address style.

    How to call hr_location_api.create_location for different address style with only those fields that belongs specific to  that address style. It should decide at run time means at run time it will come to know the type of address style and based on that only the fields which belong to address details mapped to calling hr_location_api.create_location.
    Thanks in advance.

    You can create a wrapper package on top of the API (hr_location_api.create_location)
    In the wrapper package you set all the values dynamically based on your requirements(say the style and add_line columns are populated on your conditions) and then you call the API.
    Does that not work ?

  • 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

  • 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?

  • Script for Applying master Spread

    Hi,
    This Script is for Applying CO-Opener master page  wherever CN is applied, When we run the script, it alerts Sucess.But master spread is not applied . Please resolve.
    var mydoc=app.activeDocument;
    var mypara = mydoc.stories.item(0).paragraphs.everyItem().getElements();
    for(i=0; i<mypara.length; i++){
        if (myPara[i].appliedParagraphStyle.name=="CN"){
               mypara[i].parentTextFrames[0].parent.appliedMaster = mydoc.masterSpreads.item("CO-Opener");
    alert("Master Page applied Sucessfully")

    Hi Math,
    I hope your coding is correct, but it seems stories[0] do not have "CN" Styles.
    Change the below line:
    var mypara = mydoc.stories.item(0).paragraphs.everyItem().getElements(); 
    into
    var mypara = mydoc.stories.everyItem().paragraphs.everyItem().getElements(); 
    Thanks to Jongware and Green4ever.....
    and also the use the below url to get the correct coding for CS4 and CS5 and above
    Apply Master Page using Paragraph Style
    var myDocument = app.activeDocument; 
    var myParas = myDocument.stories.everyItem().paragraphs.everyItem().getElements(); 
    var myPage = myDocument.pages; 
    for(i=0; i<myParas.length; i++) 
        if(myParas[i].appliedParagraphStyle.name == "CT") 
            //Works only in CS5 and later 
            myParas[i].parentTextFrames[0].parentPage.appliedMaster = myDocument.masterSpreads.item("B-Master"); 
            //for CS4 use this 
            //myParas[i].parentTextFrames[0].parent.appliedMaster = myDocument.masterSpreads.item("B-Master"); 
    Regards
    Siraj

  • 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

  • A script to apply cell style to entire rows containing a specific text

    Hi,
    I am using InDesign CC 2014
    Does anyone know how to apply a cellstyle based on text contents found in a cell in javascript?
    I need to search the document and change cell style in entire row to "cellStyle01" if the text "someText" appear in cell.
    I've found similar script here in forum which apply table style, but don't know how to change it to apply cell style!
    var curDoc = app.activeDocument;
    var allTables = curDoc.stories.everyItem().tables.everyItem();
    app.findTextPreferences = app.changeTextPreferences = null;
    app.findTextPreferences.findWhat = "someText";
    var allFounds = allTables.findText();
    app.findTextPreferences = app.changeTextPreferences = null;
    for ( var i = 0; i < allFounds.length; i++ ) {
    var curFound = allFounds[i];
    if ( curFound.length == 1 ) {
    var curFoundParent = curFound[0].parent; 
    // curFoundParent.parent.appliedTableStyle = curDoc.tableStyles.itemByName( "tableStyle" ); 
    curFoundParent.parent.appliedCellStyle = curDoc.cellStyles.itemByName("cellStyle01"); 
    Thanks!

    Hi,
    Try this,
    var doc = app.activeDocument, 
        _tables = doc.stories.everyItem().textStyleRanges.everyItem().getElements(), 
        i, j, k, l, a, _rows,_cells, rowlen; 
    for(i =0;i<_tables.length;i++) 
        for(j =0;j<_tables[i].tables.length;j++) 
            _rows = _tables[i].tables[j].rows; 
            for(k =0;k<_rows.length;k++) 
                _cells = _rows[k].cells; 
                for(l =0;l<_cells.length;l++) 
                    if(_cells[l].contents == "someText") 
                        rowlen = _cells[l].parent.cells.length; 
                        while(rowlen--) 
                              _cells[rowlen].appliedCellStyle = doc.cellStyles.item("cellStyle01"); 
    Regards,
    Chinna

  • Simple Script for Multiple Objects?

    Someone recently helped me with setting an opacity level for an object using this one line script and binding a keyboard shortcut to it: app.selection[0].transparencySettings.blendingSettings.opacity=50; (Pressing "5" sets the object's opacity to 50%)
    Although the script works perfectly for one object, when mutiple objects are selected it only affects the first selected object. Can someone show me how to get this script to affect multiple objects at once?
    Thanks in advance!

    Thanks for the help man, but what's with the snarky comment? lol. Yeah I use my "5" key daily as well. But in ID it does nothing while in the default context, so why not put it, and the other digits to use to quickly set object opacity? (this function is similar to setting opacity for Photoshop layers by the way).
    Have a nice day, and cheer up. Spring's almost here.

  • How to write script to apply character style?

    Hi,
    I'm on a Macbook pro and without a number pad so I can't assign a shortcut for the character styles. I did hear of a roundabout solution where you can assign a shortcut to a script which applies the character styles. Can anyone write this script?
    My character style is called 'Features bold'.
    I'm new to scripting, sorry if this is a dumb question.
    Cheers

    Hi,
    1. Save this code as .jsx file inside your Script Panel folder
    2. Apply a shortcut using Edit:Keyboard shortcuts... menu
    Option to choose:
    suggest to choose an option "context": "Text", so you can use more shortcuts which are busy with other contexts.
    #target indesign
    if (app.selection && app.selection[0].hasOwnProperty ("baselineShift") ) {
      var cName = "Features bold";
      var mCstyle = app.activeDocument.characterStyles.item(cName);
      if (mCstyle.isValid)
           app.selection[0].applyCharacterStyle(mCstyle);
      else
           alert ("CharStyle: " + cName + " not found");
    else
      alert ("Some text supposed to be selected...");
    Jarek

  • Generating .sql script for all objects of a User/Schema

    Hi All,
    What are the ways in which I can generate scripts for a full USER (all objects) with dependencies. (by dependencies I mean for example that PK be created first before creating FK).
    We can export the full schema using (exp rows=n) but this will generate a .dmp file. I want a .sql file which can be run on any other machine (from SQL> prompt) so that user and all objects are created (without the need to use "imp").
    Thanks
    -AKJ

    But the easiest way to do this would be to do an export with rows=N and then an import.
    You coule do an export and then let run the import utility with indexfile=<you_name_it>.sql and this way you'll get a file with all statements included (but table definition commented out).
    Or you do it yourself (DIY-method), where you have to select all your relevant objects and their dependencies.

  • [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.

  • Need shell Script for Invalid object

    Hi All,
    Can anyone post me a script for checking the invalid objects in 10g/11g database.
    The should should check for invalid objects,recompile and sent the email .

    I could think fo something like below(And applicable to multiple SID's running on the server) and i tested it it works(bash shell script)
    Assumptions:
    You have environmental file to set ORACLE_HOME ORACLE_SID
    say in this example
    /oracle/env
    ls -ltr
    env_ORCL.sh
    env_TEST.sh
    env_HR.sh
    You also have uuencode rpm installed to use along with mailx command(or else get it installed not big deal). uuencode is required
    to send as mail attachment
    1)I have kept SID list in file (/oracle/INVALID directory for eg)
    cat SID.lst
    ORCL
    TEST
    HR
    If you have lot of SID's you can populate the file using ( ps -ef|grep -i pmon | grep -v grep | awk '{print$9}' | sed 's/ora_pmon_//g' > SID.lst)
    2) Here are the list of SQL's(/oracle/INVALID directory
    cat invalid_pre.sql (For listing invalid objects per instance)
    set echo off
    set heading off
    set time off
    set timing off
    spool invalid.log append
    break on instance_name
    select instance_name , a.*
    from (select owner,count(*) from dba_objects where status='INVALID' group by owner) a, v$instance;
    spool off
    exit;
    cat invalid_compile.sql--to recompile invalid objects
    set echo off
    set termout off
    set feedback off
    @?/rdbms/admin/utlrp.sql 4; (Note you change degree 4 or 8 accordingly)
    exit;
    cat invalid_post.sql--to list post recompilation
    set echo off
    set heading off
    set time off
    set timing off
    spool invalid_post.log append
    break on instance_name
    select instance_name , a.*
    from (select owner,count(*) from dba_objects where status='INVALID' group by owner) a, v$instance;
    spool off
    exit;
    3)here is the shell script
    cat invalid.sh
    for i in `cat SID11g.lst`
    do
    cd /oracle/env/
    source env_$i.sh
    cd /oracle/INVALID
    sqlplus "/as sysdba" @invalid_pre.sql
    sqlplus "/as sysdba" @invalid_compile.sql
    sqlplus "/as sysdba" @invalid_post.sql
    done
    uuencode invalid.log invalid.log | mailx -s "Invalid" <your mail id>
    uuencode invalid_post.log invalid_post.log | mailx -s "Invalid" <your mail id>
    4) Finally run the shell script, hopefully you should receive email :-)
    I have tested it on bash
    ./invalid.sh
    Once tested you can schedule it in cron
    Edited by: vreddy on Jul 19, 2012 9:57 AM

  • InDesign CS4 crashing when applying object styles

    When i try to use IObjectStyleSuite->ApplyObjectStyle with the name of an object style that is inside a group, indesign Crashed.
    I've tried using the full name of the style path -> group:stylename but it doesn't work.
    Anyone faced this problem?
    Thanks in advance.

    As a last resort, when I run into the weird problems, I go through a process of elimination to find the offender.
    As example, I would delete half the images and try the update. if it works, I know the problem was in one of the images I deleted. If it doesnt, I'd delete the other half and try again. I keep cutting the number of images I remove in half till I'm down to whatever it was causing the problem. The I save it as a newfile type and re-import/place.
    Kind of a pain in the tookas, but it works when I'm really stumped.
    HTH
    -Ted

Maybe you are looking for

  • How do I download Edge Animate?

    I downloaded the Application Manager, which is where the Edge link took me. However, Application manager failed to open. I received an error message, it quit unexpectedly. What is the correct step to download Edge Animate?

  • Will not display page

    For some reason after uploading my page to the website- I am unable to see it. The page has CSS stylesheet linked to it and I am able to get page source info ( my code) - if I unlink CSS and re-upload- i see my page ( unformatted of course, without C

  • How to exec .pl files which is in a jar package?

    hi, i'm new to java so hope all the experts could give me a hand on this. i've a package structure as shown below. as you can see the a.pl file is in the lib folder which will be packaged in A.jar. so how am i able to call to execute the a.pl script

  • Bonjour Services could not be stopped

    I've had it with the stupid bonjour services. I have searched for countless hours for a solution, and even emailed the head-honchos. But it was "out of their field." A message pops up during installation, and says, "Service 'Bonjour service' (Bonjour

  • Distribution Model documentation

    Hello All, We are working on developing an approach to implement SAP in overseas markets for a Food and Beverages firm. The firm uses three basic distribution models- Third Party Commissionaire Fully Owned Right now the client is moving from a Commis