Create 'Object Style' by script

Hi,
My 'Library.indl' file has the 'Box1', 'Box2'. I need to create the object style(with dummy properties) based on the Library file names.
If the library has BOX1, BOX2, I need to check my Indesign file has Object Style with the same name(BOX1, BOX2).
If object style not presented in that particular name(BOX1, BOX2) in Indesign, I have to create the dummy Object style. (The 'object style name' should match with BOX1, BOX2.)
Is this possible by Indesign script?
by
hasvi

Hi Chinna,
When I click 'hyphenation setting' on, I have the problems on line 54 and 55.
If I select line 55(line 54 is deselect). script working fine.
If I select line 54(line 55 is deselect) script is not working, but I want to select library file from the folder path, so I need line 54 action.
Correct my script here:
var w = new Window ("dialog", "Template Checklist", undefined, {closeButton: false});
w.alignChildren = "left";
var check1  = w.add ("checkbox", undefined, "Hyphenation Settings");
var check2  = w.add ("checkbox", undefined, "Object Style creation based on Library");
var buttons = w.add ("group");
buttons.add ("button", undefined, "Ok");
var Exit = 0;
var cancel = buttons.add ("button", undefined, "Cancel")
        cancel.onClick = function()
                w.close();
                Exit = 1;
w.show ();
if(Exit ==1)
        this.exit();
var myDocument = app.activeDocument;
if (check1.value == true)
    var myPara=app.activeDocument.paragraphStyles;
    for(var i=1;i<myPara.length;i++)
            if(myPara[i].hyphenation)
            //myPara[i].hyphenation=true;
            myPara[i].hyphenateWordsLongerThan=6;
            myPara[i].hyphenateAfterFirst=3;
            myPara[i].hyphenateBeforeLast=3;
            myPara[i].hyphenateLadderLimit=2;
            myPara[i].hyphenationZone="1p";
            myPara[i].hyphenateCapitalizedWords=true;
            myPara[i].hyphenateLastWord=false;
            myPara[i].hyphenateAcrossColumns=false;
    var myStyle=new Array("BK_TTL","BK_HTTL")
    for(var i=0;i<myStyle.length;i++)
            if(myDocument.paragraphStyles.item(myStyle[i]).isValid)
             myDocument.paragraphStyles.item(myStyle[i]).hyphenation = false;
if (check2.value == true)
alert("Library File is must for this process.");
//~ var library = File.openDialog ("Select the Library File", "*.indl");  ////Your library file path.
var library=new File("C:\\Users\\Jayanthi\\Desktop\\Library.indl");//Your library file path.
app.open(library);
asset = app.libraries[0].assets;
for(var i=0;i<asset.length;i++)
    try{
        myDocument.objectStyles.add({name:asset[i].name});
    catch(e){}
var ProgressBar = function(/*str*/title)
     var w = new Window('palette', ' '+title, {x:0, y:0, width:340, height:60}),
          pb = w.add('progressbar', {x:20, y:12, width:300, height:12}, 0, 100),
          st = w.add('statictext', {x:10, y:36, width:320, height:20}, '');
     st.justify = 'center';
     w.center();
     this.reset = function(msg,maxValue)
          st.text = msg;
          pb.value = 0;
          pb.maxvalue = maxValue||0;
          pb.visible = !!maxValue;
          w.show();
     this.hit = function() {++pb.value;};
     this.hide = function() {w.hide();};
     this.close = function() {w.close();};
//      SAMPLE CODE
function main()
     var pBar = new ProgressBar("Running");
     var i;
     // Routine #1
     pBar.reset("Please wait Processing ...", 100);
     for( i=0 ; i < 100; ++i, pBar.hit() )
          $.sleep(10);
     // Routine #2
     pBar.close();
main();
exit();
by
hasvi

Similar Messages

  • Indesign CS6 Object Style (Transparency) Script

    I've been trying to find and/or make my own script for a simple function in InDesign with no luck. Basically I just want all placed images to have a transparency setting of 99%. That's it.
    I know I can create an object style with this setting and could select all my graphic frames and apply the style, but it would be a lot easier if I had a script that just defaulted to the 99% transparency in every document I create.
    Please & Thank you!

    @slaos – really ALL placed graphics? Also PDFs and Illsutrator files, EPS files as well? Together with PSDs, TIFs, JPEGs, PNGs and WMFs?
    Then, and only then, run this ExtendScript code on an open document ( make a duplicate before, just in case! ):
    var myDoc = app.documents[0];
    var myAllGraphicsArray = myDoc.allGraphics;
    var myProperties = {
        blendMode : BlendMode.NORMAL,
        opacity : 99
    for(var n=0;n<myAllGraphicsArray.length;n++){
        try{
        myAllGraphicsArray[n].transparencySettings.blendingSettings.properties = myProperties;
        }catch(e){alert(e.message)};
    This would not affect the container frames, only the placed graphics inside the containers!
    Uwe

  • ActiveX can't create object when VB Script called from Labview

    I have an interesting issue that I can't find a solution for. I am using the DIAdem Run Script.VI in Labview to call a script that opens an Outlook object and sends an email. When the script is called via LabView I get this error:
    However, when I manually run the script from the DIAdem script tab it works as expected with no errors.
    This is the code:
    'Begin email send function
    Dim oOutlookApp
    Dim oOutlookMail
    Dim cnByValue : cnByValue = 1
    Dim cnMailItem : cnMailItem = 0
    ' Get Outlook Application Object
    Set oOutlookApp = CreateObject("Outlook.Application")
    ' Create Mail Item
    Set oOutlookMail = oOutlookApp.CreateItem(cnMailItem)
    ' Set Mail Values
    With oOutlookMail
    .To = "[email protected]"
    .Subject = "Report: " & Data.Root.ActiveChannelGroup.Name & " for " & CurrDate
    .Body = "test automatic report emailing with VB Script."
    ' Add Attachement
    Call .Attachments.Add(strLocFileName, cnByValue, 1 )
    ' Send Mail
    Call .Send()
    End With
     (Original code includes Option Explicit and all variables are properly included/declared, I just took the snippet of what's causing the error).
    I have looked at the following threads for info already:
    http://forums.ni.com/t5/DIAdem/Some-errors-when-calling-LabVIEW-VIs-Interactively-from-DIAdem/td-p/2...
    http://forums.ni.com/t5/DIAdem/Active-X-component-cannot-create-object-Diadem-8-1/m-p/71212/highligh...
    -I tried running the script via Windows explorer (per Brad's suggestion) by itself without the DIAdem specific functions and it runs fine.
    http://forums.ni.com/t5/DIAdem/Error-while-runing-diadem-asynchronous-script-from-labview-on/m-p/111...
    -I am not running the scripts asynchronously
    Using Windows 7 (64bit), DIAdem 11.2 and LabView 7.1.1
    Thank you.

    Hey techerdone -
    I'm afraid I personally can't be of much help - I tested your code both from DIAdem and from LabVIEW and each worked without issues in both cases (Outlook closed, Outlook open).  I'm using DIAdem 2011 SP1, LabVIEW 2011, and Outlook 2007...
    Derrick S.
    Product Manager
    NI DIAdem
    National Instruments

  • 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

  • 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

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

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

  • 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

  • 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

  • SBO2004A: Runtime Error 429 ActiveX Component can't Create Object

    Hello,
    We have an Addon developed with VB6 that run without problems with SBO 6.5.
    We have upgraded to SBO2004A and I have referenced in the source code to the 2004 UI and DI. I debug mode (from IDE) we don't have problems, but when I try to execute the addon from a client, I get this error message:
    <b>Runtime Error 429 ActiveX Component can't Create Object</b>
    Thanks in advance
    Blas

    I'm using Installshield 10.5 to generate the setup file. It's much more easy and not requiered to install Framework 1.1 in each PC client before to install the Addon.
    You have to create and msi project, and write the Installscript to retrieve the install directory from parameter string passed by SAP.
    After install you must execute the AddOnInstallAPI.EndInstall to notify SAP:
    #include "ifx.h"
    prototype  LONG AddOnInstallAPI.EndInstall();  
    prototype  LONG AddOnInstallAPI.RestartNeeded();
    // OnFirstUIBefore
    // First Install UI Sequence - Before Move Data
    // The OnFirstUIBefore event is called by OnShowUI when the setup is
    // running in first install mode. By default this event displays UI allowing
    // the end user to specify installation parameters.
    // Note: This event will not be called automatically in a
    // program...endprogram style setup.
    function OnFirstUIBefore()
        number  nResult, nLevel, nSize, nSetupType;
        string  szTitle, szMsg, szOpt1, szOpt2, szLicenseFile;
        string  szName, szCompany, szTargetPath, szDir, szFeatures, szTargetdir;
        BOOL    bLicenseAccepted;
        LIST listID;
    begin     
        nSetupType = COMPLETE;       
        szDir = TARGETDIR;
        szName = "";
        szCompany = "";
        bLicenseAccepted = FALSE;
    // Beginning of UI Sequence
    Dlg_Start:
        nResult = 0;
    Dlg_SdWelcome:
        szTitle = "";
        szMsg = "";
        //{{IS_SCRIPT_TAG(Dlg_SdWelcome)
        nResult = SdWelcome( szTitle, szMsg );
        //}}IS_SCRIPT_TAG(Dlg_SdWelcome)
        if (nResult = BACK) goto Dlg_Start;
    Dlg_SdLicense2:
        szTitle = "";
        szOpt1 = "";
        szOpt2 = "";
        //{{IS_SCRIPT_TAG(License_File_Path)
        szLicenseFile = SUPPORTDIR ^ "License.rtf";
        //}}IS_SCRIPT_TAG(License_File_Path)
        //{{IS_SCRIPT_TAG(Dlg_SdLicense2)
       // nResult = SdLicense2Rtf( szTitle, szOpt1, szOpt2, szLicenseFile, bLicenseAccepted );
        //}}IS_SCRIPT_TAG(Dlg_SdLicense2)
        if (nResult = BACK) then
            goto Dlg_SdWelcome;
        else
            bLicenseAccepted = TRUE;
        endif;
    Dlg_SdRegisterUser:
        szMsg = "";
        szTitle = "";
        //{{IS_SCRIPT_TAG(Dlg_SdRegisterUser)     
       // nResult = SdRegisterUser( szTitle, szMsg, szName, szCompany );
        //}}IS_SCRIPT_TAG(Dlg_SdRegisterUser)
        if (nResult = BACK) goto Dlg_SdLicense2;
    Dlg_SetupType2:  
        szTitle = "";
        szMsg = "";
        //{{IS_SCRIPT_TAG(Dlg_SetupType2)     
       // nResult = SetupType2( szTitle, szMsg, "", nSetupType, 0 );
        //}}IS_SCRIPT_TAG(Dlg_SetupType2)
        if (nResult = BACK) then
            goto Dlg_SdRegisterUser;
        else
            nSetupType = nResult;
            if (nSetupType != CUSTOM) then
                szTargetPath = TARGETDIR;
                nSize = 0;
            endif;  
        endif;
    Dlg_SdAskDestPath2:
        if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType2;
         szTitle = "";
        szMsg = "";
        if (nSetupType = CUSTOM) then
                    //{{IS_SCRIPT_TAG(Dlg_SdAskDestPath2)     
    //          nResult = SdAskDestPath2( szTitle, szMsg, szDir );
                    //}}IS_SCRIPT_TAG(Dlg_SdAskDestPath2)
            TARGETDIR = szDir;
        endif;
        if (nResult = BACK) goto Dlg_SetupType2;
    Dlg_SdFeatureTree:
        if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdAskDestPath2;
        szTitle = "";
        szMsg = "";
        szTargetdir = TARGETDIR;
        szFeatures = "";
        nLevel = 2;
        if (nSetupType = CUSTOM) then
            //{{IS_SCRIPT_TAG(Dlg_SdFeatureTree)     
           // nResult = SdFeatureTree( szTitle, szMsg, szTargetdir, szFeatures, nLevel );
            //}}IS_SCRIPT_TAG(Dlg_SdFeatureTree)
            if (nResult = BACK) goto Dlg_SdAskDestPath2; 
        endif;
    Dlg_SQLServer:
        nResult = OnSQLServerInitialize( nResult );
        if( nResult = BACK ) goto Dlg_SdFeatureTree;
    Dlg_ObjDialogs:
        nResult = ShowObjWizardPages( nResult );
        if (nResult = BACK) goto Dlg_SQLServer;
    Dlg_SdStartCopy2:
        szTitle = "";
        szMsg = "";
        //{{IS_SCRIPT_TAG(Dlg_SdStartCopy2)     
        nResult = SdStartCopy2( szTitle, szMsg );     
        //}}IS_SCRIPT_TAG(Dlg_SdStartCopy2)
        if (nResult = BACK) goto Dlg_ObjDialogs;
        return 0;
    end;        
    // OnSetTARGETDIR
    // OnSetTARGETDIR is called directly by the framework to initialize
    // TARGETDIR to it's default value.
    // Note: This event is called for all setups.
    function OnSetTARGETDIR()
    number nId, nIgnore, nResult;
    string szId, szTARGETDIR; 
    string wCMDLINE;
    LIST listID;     
    begin     
        // In maintenance mode the value of TARGETDIR is read from the log file.
        if( MAINTENANCE ) then
            return ISERR_SUCCESS;
        endif;
        // Set TARGETDIR to script default.
        TARGETDIR = "<FOLDER_APPLICATIONS>
    <IFX_COMPANY_NAME>
    <IFX_PRODUCT_NAME>";
        if (CMDLINE != "") then 
           wCMDLINE = CMDLINE;   
           StrReplace (wCMDLINE, '"', '', 0);
           listID = ListCreate (STRINGLIST); 
           if (StrGetTokens (listID, wCMDLINE, "|") > 0) then
              MessageBox ("Parametros incorrectos.", SEVERE);
           else
              ListGetFirstString (listID, TARGETDIR);  
              //MessageBox (TARGETDIR, INFORMATION);
           endif;
           ListDestroy (listID); 
           return 0;
        endif;
        // Read TARGETDIR from the media.
        nResult = MediaGetData( MEDIA, MEDIA_FIELD_TARGETDIR, nIgnore, szTARGETDIR );
        // Use the TARGETDIR from the media if anything was read.
        if( nResult >= ISERR_SUCCESS && StrLengthChars( szTARGETDIR ) ) then
            TARGETDIR = szTARGETDIR;
        endif;
         // Customize the default TARGETDIR for multi-instance application.
         // TODO: If you want something different customize the code below.     
         if( MAINT_OPTION = MAINT_OPTION_MULTI_INSTANCE  && MULTI_INSTANCE_COUNT > 0) then
              // Start with the current multi-instance count plus one.
              nId = MULTI_INSTANCE_COUNT + 1;
              // Find a unique TARGETDIR.
              while( ExistsDir( TARGETDIR ) = EXISTS )
                   // Convert to string.
                   NumToStr( szId, nId );
                   // Update IFX_MULTI_INSTANCE_SUFFIX
                   IFX_MULTI_INSTANCE_SUFFIX = "_" + szId;
                   // Update TARGETDIR
                   TARGETDIR = TARGETDIR + IFX_MULTI_INSTANCE_SUFFIX;
                   // Update nId
                   nId = nId + 1;
              endwhile;
         endif;  
    end;
    // OnEnd
    // The OnEnd event is called at the end of the setup. This event is not
    // called if the setup is aborted.
    function OnEnd() 
    string  wCMDLINE;
    LIST    listID;     
    STRING  DLL_FILE;
    INT     nValue;  
    LONG    nRC;
    NUMBER  nResult;
    begin
    if (CMDLINE != "") then
           wCMDLINE = CMDLINE;   
           StrReplace (wCMDLINE, '"', '', 0); 
           listID = ListCreate (STRINGLIST); 
           if (StrGetTokens (listID, wCMDLINE, "|") > 0) then
              MessageBox ("Parametros incorrectos.", SEVERE);
           else
              ListGetFirstString (listID, DLL_FILE);
              ListGetNextString (listID, DLL_FILE);  
              // MessageBox (DLL_FILE, INFORMATION);
           endif; 
           ListDestroy (listID); 
           nResult = UseDLL (DLL_FILE);
           if (nResult != 0) then
              MessageBox ("No se ha podido cargar\nAddOnInstallAPI.dll", SEVERE);
              abort;
           endif;
           if AddOnInstallAPI.EndInstall() > 0 then
              MessageBox ("Error al ejecutar AddOnInstallAPI", SEVERE);
              abort;
           endif;
    endif;
    end;

  • 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

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

  • Changing Object Style

    I have a script that adds a stroke around the piece, that is a spot color called Dieline. It works great except if the supplied file has a Object Style defined. The box it creates has that style applied to it. I would like to change the Object style to "None" but am having troubles figuring out how to accomlish this.
    Any help would be greatly appriecatated.
    //Script to create dieline at page size
    main();
    function main(){
        var myDocument = app.activeDocument;
        var myDielineColor = getOrAddColor(myDocument, "Dieline", ColorModel.spot, [100, 0, 0, 0])
        var myNoneSwatch = myDocument.swatches.itemByName("None");
        createLayer(myDocument, "Dieline");
        for (x=0;  x < app.activeDocument.pages.length ; x++) {
            myPage = app.activeDocument.pages[x]
            var myCoord = myPage.bounds;
            //Create the rectangle and move it to the Dieline layer
            var myRect = myPage.rectangles.add({fillColor:myNoneSwatch, strokeColor:myDielineColor, geometricBounds:(myCoord)});
            myRect.itemLayer = myDocument.layers.itemByName("Dieline");
    function createLayer(myDocument, myLayer){
         if(!myDocument.layers.item(myLayer).isValid){
             myDocument.layers.add({name:myLayer})
             .move(LocationOptions.AT_BEGINNING)
    function getOrAddColor(myDocument, myColorName, myColorModel, myColorValue){
              if(!myDocument.colors.item(myColorName).isValid){
            var myColor = myDocument.colors.add();
            myColor.name = myColorName;
            myColor.model = myColorModel;
            myColor.colorValue = myColorValue;
         else {
            var myColor = myDocument.colors.itemByName(myColorName);
        return myColor

    Hi,
    Do it in two separate steps:
    1. apply objectStyle "None"
    2. apply your properties
    so inside your loop:
    var myRect = myPage.rectangles.add( { appliedObjectStyle: myDocument.objectStyles.item(0) } );
    myRect.properties = {
         fillColor:myNoneSwatch,
         strokeColor:myDielineColor,
         geometricBounds: myCoord
    myRect.itemLayer = myDocument.layers.itemByName("Dieline");
    Jarek

  • Crystal Report Addon Error : ActiveX Component Can't Create Object

    Hello Experts,
    We are facing an problem when we start the Crystal Report Addon .The error message getting
    displayed is  "CR_Crypto ActiveX Component Can't Create Object".This issue is happening only on the
    server its working fine on the client. We had even unistalled and re-installed the addon in the server but
    still it throws the error when we start the addon.
    Please help us to resolve this issue
    Thanks,
    Vishwanath

    Dear Friend,
                 I had described the problem to our technical support team, and they replied as follows u2013
    They solved the Script related error by several stages.
    They checked the machine for any mal-ware existence by the tool provided by Microsoft (MS Mal-ware remover).
    Then they tried by installing the following patches from Microsoft u2013
    http://support.microsoft.com/kb/949140
    Windows Script 5.7 for Windows XP
    http://www.microsoft.com/downloads/details.aspx?familyid=887fce82-e3f5-4289-a5e3-6cbb818623aa&displaylang=en
    Windows Script 5.6 for Windows Server 2003
    http://www.microsoft.com/downloads/details.aspx?FamilyId=C717D943-7E4B-4622-86EB-95A22B832CAA&displaylang=en
    Windows Script 5.6 for Windows XP and Windows 2000
    The internal matter to this problem was about the following DLL and its version u2013
    C:\WINDOWS\system32
    vbscript.dll
    5.5.0.8820
    Desired
    5.6.0.8820
    Check, if the information helps you.

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

Maybe you are looking for

  • NAT for remote access VPN clients

    Hello, I have a simple remote access VPN setup on a 2811 router. The remote subnet of the clients connecting have access to the local LAN subnet, but I am wondering if it is possible to somehow NAT those remote access users, so that they can go beyon

  • Dock won't launch

    Using 10.7.4. Dock does not launch when I scroll over the bottom of the screen. System Preferences will not allow me to deselect "Automatically hide and show the dock." The only way I can currently access Dock is to use Hot Corners and pull up the Do

  • No sound in videos problem!

    Ever since I updated my desktop Mac with Mavericks I have been having ongoing issues with movies I have on my Mac. They were originally downloaded as (.avi) format however with the new Mavericks these videos go through a conversion process turning th

  • ISE Android certificate issue

    Hello team, I am facing issue with ISE after changing the domain name, new default certificate was generated and also the old cert is available, because of 2 group certs facing issue, any facing the same issue.

  • Workflow Request Problem

    Dear All, I created a workflow in the sandbox and saved it as a local object. Now in the original client where I want to make a request for the workflow which i will be needing to transport to Production,when i saved the workflow it is not asking for