Indesign Applescript Placed Object Layer Visibilty Override

Hi, trying to programmatically control layer visibility of placed objects (either AI or other ID files) in a multi-page Indesign document.  Have looked all over the dictionary but can't seem to figure a way to reference the layers.
Would someone have an example of how to do this in Applescript?  (Please, not javascript, will convert one day but for now am staying with AS.)
Thanks!

Thanks, Mary, your suggestion has put me on a good path, but I'm still having some trouble.
I have several similar documents, each having multiple pages with one placed item per page that are linked, not embedded.  Each of those placed items may or may not have a layer with a specific name.  I'm trying to iterate through the links and toggle visibility of the layers within the placed objects as needed.
Ultimately the script would:
    Cycle through all links in the target doc.
        Get a list of all layers in the current link of the cycle.
        Cycle through a list of layer names to check.
            Set the desired layer to visible, all others in the list to not visible.
            (This could be with a string var that was the same as the desired entry in the list, or a numeric index var to compare with where the counter was in its cycle)
Here's a verbose example of what I've got so far.  It assumes the target document is already open...
# With which app are we working?
tell application "Adobe InDesign CC 2014"
    # With which document are we working?
    set theDocName to "My Indesign Document"
    # Which layer do we want to be visible?   
    set theDesiredLayer to "My Desired Visible Layer"
    # Set the Document ID of the chosen document
    set theDocID to document named theDocName
    # Work with the chosen document
    tell theDocID
        # Create an object of all links of the chosen document
        set theDocLinks to links of theDocID
        # Set the count of all links in the chosen document
        set theDocLinksCount to count of theDocLinks
        # Cycle through all the linked objects
        repeat with i from 1 to theDocLinksCount
            # Create an object of the current link
            set theCurLink to item i of theDocLinks
            # Set the name of the current link
            set theLinkName to name of theCurLink
            # Create an object of the parent of the current link
            set theLinkParent to parent of theCurLink
            # Create an object of the graphic layer options of the parent of the current link
            set theGraphicLayerOptions to graphic layer options of theLinkParent
            # Get a count of the layers in the current link
            set theLayerCount to count of graphic layers of theGraphicLayerOptions
            # Cycle through the layers in the current link
            repeat with j from 1 to theLayerCount
                # Create an object of the current layer
                set theLayer to item j of graphic layers of theGraphicLayerOptions
                # THIS FAILS
                set theLayerName to name of theLayer
                log "Layer: '" & theLayerName & "' ~ Visible: '" & current visibility of graphic layer theLayerName of theOptions
                # THIS WORKS ONLY UNDER CERTAIN CONDITIONS
                set current visibility of graphic layer theDesiredLayer of theGraphicLayerOptions to true
            end repeat
        end repeat
    end tell
end tell
The part that works does so only when I let it act on specific links (based on theLinkName).  If the link has no such layer, it bombs (as expected).
I'd really rather just iterate through the layers of each link and take action based on whether or not my target layer exists in that link.  For that to happen, I need to be able to access the name of the layer.
When cycling through the layers,
    set theLayer to item j of graphic layers of theGraphicLayerOptions
*should* return a graphic layer object, which has a name property that I could then use for comparison.  But that always fails.
I've also tried other properties of the graphic layer object such as parent, object reference, etc. It always bombs out when I try to work with the layer object.
The obvious conclusion is that I'm not really creating a graphic layer object, but according to the dictionary it seems this should work.
Any ideas what I'm doing wrong?
Thanks!

Similar Messages

  • Effects using Object Layer Options

    Under Object Layer Options I would love to be able to apply effects to individual layers. If I can view / turn "off" or "on" individuals layers, then why not be able to apply effects as well?
    For instance: say I have an image of an apple photographed on a white background, that includes a cast shadow, and I want to place that image on a colored background in InDesign. In Photoshop, I would build the file so the clipped apple is on layer 1. The cast shadow would be on layer 2 below.
    When placed in InDesign, and using Object Layer Options, it would be great if I could set layer 1 to "normal" and layer 2 to "multiply"... thus having only the cast shadow multiplied to the colored background.
    Currently my method would be to place the same apple image twice in InDesign (directly on top of each other). I then use Object Layer Options to hide the cast shadow on the top image and keep the object effect set at normal. For the bottom image, I set the entire image to multiply. I then group the two images together.
    Not a tedious task by any means, but having the ability to apply different layer effects to a single image would streamline the process.
    BTW: does Adobe review the Feature Requests posted in this forum, or only those posted using their wishform address?: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform.
    Just curious.

    I've seen that technique used if the shadow is built using black ink only. Does it still work if the shadow is a process blend?
    From: jblay-design <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Mon, 12 Dec 2011 13:56:11 -0700
    To: Christopher Lowe <[email protected]<mailto:[email protected]>>
    Subject: Effects using Object Layer Options
    Re: Effects using Object Layer Options
    created by jblay-design<http://forums.adobe.com/people/jblay-design> in InDesign Feature Requests - View the full discussion<http://forums.adobe.com/message/4079974#4079974

  • Keeping layer visibility overrides in CS2

    Hi,
    I apologize if this has been answered before - did a search but couldn't find what I was looking for.
    When using CS4 (6.0.3), I have no problem setting my "object layer option overrides" on a pdf file inside Indesign and having them stick when the pdf is updated.
    The problem comes when I have to use Indesign CS2 on projects.  When setting the over rides everything looks fine but when I use illustrator to make some changes to the pdf and refresh the link in Indesign, all the layers are shown and the "keep layer visibility over rides" does not do what it is supposed to do.  I have it set to only show 2 of 3 layers and the smallest change to the pdf file and a subsequent update to the link will always reset all the layers to show.  Is there a fix for this?
    Thanks,
    Rob

    From what I can tell, Illustrator CS2 does not export usable layer info. So apparently they didn't test if layer overrides would work correctly.
    It is kind of interesting that an Illustrator CS3/4 file has usable layer info in InDesign CS2, but you're correct that the layer overrides seem broken by any update to the file...

  • Object layer options in InDesign not working when I revise my file in Photoshop?

    I have placed a layered photoshop file on multiple pages in my InDesign document. The photoshop file has a folder for each page that I can turn on in InDesign with object layer options. This works well until I revise the photoshop file in any way. When the photoshop file changes, InDesign updates all of the versions of the placed image to some sort of default, no longering recognizing the object layers I chose before revising the file. I've tried both "update link options" at the bottom of the dialog box to no avail. Any suggestions? I am using CS6, version 8.0. Thank you.

    In the Object Layers Override dialog for each instance have you got it set to preseerve the current layer visibility on relink?
    That should work UNLESS you change the number, naming or ordering of layers when you edit. If you do that ID no longer knows whaat to do and always uses the current layer visibility in the saved file.

  • How to knock out the shape of a placed object

    This is a montage of approximately 250 small images in ID CS5. Each photo is a separate object. I would like to knock out the shape of the dog in silhouette to reveal the background layer, which is underneath the small images and can't be seen in this picture. Then I would like to add a drop shadow to give the background layer some depth.
    I know how to do this with either text or a shape created in InDesign, but I'm having trouble getting it to work for a placed object. I've tried using the silhouette as an EPS, AI and PSD but can't figure it out.

    Draw a large frame to cover the page. Place the dog over that and use the
    pathfinder panel to cut the dog out of the frame. Now group the little
    images and cut them to the clipboard. Paste into the frame with the cutout.

  • Modify "object layer properties" on all odd/even pages based on...

    Hello,
    looking for a script to modify the "object layer properties" of placed .indd files.
    Ideal, a script wich runs on all even pages (based on master B), and sets the object layer options to layer1 visible/2 invisble.
    and on the odd pages: layer1 invisible/2 visible...
    don't know where to start...
    If there are some freelance scripters on the forum?
    grts!!!

    I'm looking for someone to write it for me.
    Are you an experienced indesign scripter?
    We very often need indesign scripts...wich language do you use?
    grts
    Stijn Van Roey :: m. 0496123279 :: [email protected]

  • Converting Simple Indesign AppleScript to Javascript

    Hi,
    I have been using as imple Indesign AppleScript but need to convert it to javascript and have no prior experience.  I've been reading the Adobe pdf about scripting and it is great as it shows the differences between the 3 (as, js, vb) but I'm still having trouble figuring out how this would conver.  Would anyone be able to show me the converted result?
    AppleScript:
    tell application "Adobe InDesign CS5.5"
         tell every document
              set visible of layer "Interactive - Web" to true
              set visible of layer "Interactive - Print" to false
         end tell
    end tell
    Javascript:
    var myDocuments = app.documents.everyItem(); // something like this?
    It hides/shows the visibility of 2 specific layers for all opened documents.  I pretty much need to hide/show 2 specific layers ina  book and this should/can accomplish that.
    Thanks for any help!

    This should work:
    var documentsArray = app.documents.everyItem().getElements();
    for (var i = 0; i < documentsArray.length; i++) {
              var document = documentsArray[i];
              var layers = document.layers;
              layers.itemByName("Interactive - Web").visible = true;
              layers.itemByName("Interactive - Print").visible = false;
    Also, it might be possible to do this without using "getElements" which "resolves the object specifier", eliminating the need for the "for" loop. Something like this:
    app.documents.everyItem().layers.itemByName("Interactive - Web").visible = true;
    app.documents.everyItem().layers.itemByName("Interactive - Print").visible = false;

  • Layer Visibility Override icon

    My maps team have just seen this icon and are wondering why it's appeared in the links icon.
    I looked in the help section to find out but couldn't find much about it, does anyone have a second to explain to me regarding this icon, or how to turn it on or off?
    hope to hear from you
    Brgds
    Alex

    Help > InDesign Help
    Search for
    layer PSD
    Look for topic
    To set layer visibility for placed PSD or PDF files
    That should help.
    The icon beside the link it telling you someone has adjusted the visibility of its layers by using the Object Layer Options dialog box.
    HTH
    -mt

  • Smart object layer from PS to AI. how to use??

    I successfully work AI vector objects as placed objects into PS by copy pasting or file/place into a smart object layer in PS, I find value in making changes to my vector object dimensions in AI and seeing them updated in PS,
    but I don`t know how to do it the other way, meaning a PS jpeg on a layer to AI as smart object, I choose an image on its own layer in PSCS4 and convert to smart object, I (right click) export the contents as jpeg smart object, and then back in AI go file/place the smartobject jpeg, when I make changes to the PSsmartobject in PS like colour shift or dimensions change nothing happens in AI,
    I would like to have an image pasted from PS into AI whereby I can change colours and dimensions or add pixels like paint on that smartobject layer in PS and then have it update in AI...

    To my knowledge Illustrator does not support smart objects. However it does support image linking. Which means if you update a image in photoshop, Illustrator will know the file has changed.
    When placing the file, you will see a checkbox at the bottom of the open dialog box for link, make sure it is checked. When you update the file when Illustrator is running with that file opened, you will get a promt telling you the file has changed and asked you if you want to update the image.
    If you choose not to update the image at that time, you can click on the linked file text in the top tool bar and update the image from there.
    If the file is not open or Illustrator is not running then the file will update the next time you open the file.
    Also you will find a edit original button in the top tool bar to take you back to what ever image editor is assigned to that file format.
    To assign a file format to photoshop:
    For this example we will use jpeg extention
    1) Open windows explorer
    2) Menu options tools>folder options>File types tab>scroll to jpeg and click on it
    3) Click the advanced tab
    4) see what actions are listed odds are only open and printo are listed
    5) If Edit is not listed, click on the new button
    6) For the action type EDIT
    7) For the application used to perform action click the browse button
    8) Browse for photoshop.exe
    9) The following should now be in the application used to perform action box:
    "C:\Program Files\Adobe\Adobe Photoshop CS3\Photoshop.exe" %1
    The above file location is assuming you have CS3 and you used the default installation edit original button in Illustrator and the right mouse button menu in windows explorer will take you to photoshop to edit the file.
    10) After you click OK you will see the new EDIT action in the list
    11) Click OK  and then click close to get out of all the dialog boxes
    The action can be removed at any time or edited to use another application.

  • I place a psd file with transparent background on another layer in my InDesign document. The layer b

    I placed a psd file with transparent background on another layer in my InDesign document. The layer below has a color (RGB). When the psd file is placed it changes the color on the layer below. I've tried other psd files thinking something is wrong with my file, but get the same result. I have tried for days to figure this out. Can anyone help me?

    Wow, thank you! That was fast. I googled that question to death and even bought (another) book on CS5 and never saw that answer. Thank you so much. You made a very good ending to my day! I'd buy you a beer if I could!!

  • Placed objects not printing correctly

    Not sure if this is a bug in the new update, but this just started happening on all of my Indesign documents, some of which are fairly old and have been used hundreds of times. All adobe programs are CS6 Master/Photoshop X Pro.
    When I go to print one of these, any object that is placed on the worksheet, prints blurry, or very poor quality. Text or shapes that are part of the document and not placed print correctly.
    The placed objects are mainly vector based illustrator documents, but there's a few from photoshop. I don't see any errors, the files aren't being rasterized or anything and all have the correct paths. I've tested with about 20 documents and every one does this. I am 100% certain, that these files printed fine 2 days ago, and to my knowledge there hasn't been any changes to the computer or any adobe program. These were just routine brochures we were printing. Is there some setting that I'm missing that would cause placed objects to print incorrectly?

    Sounds like the links are out of date or you’ve selected optimized subsampling when printing.
    FWIW, I NEVER print from InDesign. I always export a PDF and print from Acrobat.
    Bob

  • Extracting an .xmp sidecar from an ACR-edited RAW smart object layer...

    Hello all.  Given the following situation:
    Several thousand TIFF files, each containing two RAW files embedded into separate Smart Object layers.  The RAW files were named with sequential numbers prior to being composited into the TIFF files via a script, and the TIFF filenames correspond to those of the embedded RAW files.  The RAWs have subsequently been edited in ACR from within the TIFF files.
    I've done a little digging, but I can't seem to turn up answers to several related questions:
    A) Should I wish to re-extract the RAW files from the smart object layers with the edits that have been applied, is there a method of PerLayerMetdata that can be used to extract a complete .xmp sidecar that will be recognized by ACR and associated with the exported RAW?
    B) Should I wish to change the sequential-naming of the parent TIFF files, is there any method to correspondingly change the filenames of the embedded RAWs directly within the smart object layer?  In other words, using PerLayerMetdata, can the filenames of the RAWs be changed without exporting the RAWs using a different filename and then replacing the contents of the smart object layer?
    C) I would ultimately like to be able to save the embedded RAWs as DNGs with their ACR edits applied, if necessaray.  Given a way to accomplish A), above, it would be a fairly simple to export the RAWs and associated .xmp files and then run the DNG converter on the lot.  However, does anyone know of a way to save a DNG directly from the smart object layer?
    Any ideas or pointers to existing documentation are much appreciated.

    Thank you kindly, Michael.  I see now that the example I was viewing had done exactly what you describe, writing ACR settings into the SO layer's metadata at the time of embedding.  I was only looking at the portion which later accessed those settings using PerLayerMetadata, and I had mistakenly assumed that CS5 was automatically embedding xmp data in this manner, now, when opening or placing a RAW file as a SO.
    I don't see a direct way to get at the ACR settings of a camera raw file embedded in a smart object.
    This is sort of what I was afraid of.  They're in there, somewhere, but I'm having no luck figuring out how to access them.
    If the ACR settings for a RAW smart object are, indeed, not exposed to automation in some manner, I think I must change my workflow such that either: A) No edits are performed in ACR after object embedding; or B) the RAWs are converted to DNGs prior to smart-object embedding so that the ACR settings can be exposed in the exported file.

  • When placing object from Illy, how does ID design which artboards to present

    Could someone walk me through placing objects into ID documents from an Illustrator file with multiple layers? Does it only present the artboards that are present in the topmost layer? Or is it all visible layers?

    After you select the artboard you want and place the file, you can change the layer visibility by selecting the object, right-clicking and choosing object layer options.

  • InDesign is placing a drop shadow on the art I place on documents in creation stage

    InDesign is placing a drop shadow on the art I place on documents in creation stage and need to stop that from happening.

    Then I guess you need to provide a LOT more detail about what is happening. Do you use object styles? Have you checked to be sure that drop shadow is not active with no object selected?

  • Invoking script using smart object layer - fails in Windows

    I have recently encountered in what seems to be a bug in Configurator in Windows. The same example works on a Mac.
    The scenario is the following: a document with a smart object layer on top.
    A configurator button executes the script app.activeDocument.activeLayer.resize(133.33333, 133.33333, AnchorPosition.MIDDLECENTER);
    This causes an error message as below:
    If I instead invoke the script manually, using File > Scripts > Browse... it works fine.
    The button works fine if the smart object is rasterized.
    I'm running Configurator 2 (052610), CS5 and Windows XP. Any help is greatly appreciated!

    In sure if this is all you need to correct the error but the function below will return the active smart object contents type.
    // returns either "vectorData" ( AI ) or "rasterizeContent" ( PS or ACR ) if smart cbject layer
    // or undefined if not smart object layer
    function getSmartObjectType(){
        var ref = new ActionReference();
        ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
        var desc = executeActionGet(ref);
        if(desc.hasKey(stringIDToTypeID('smartObject'))){// is smart object?
            var desc = executeActionGet(ref).getObjectValue(stringIDToTypeID('smartObject')).getEnumerationValue(stringIDToTypeID('placed'));
            return typeIDToStringID(desc);

Maybe you are looking for

  • Safari won't open , I suspect I deleted and important plug in

    Ok so yesterday I was going through some useless files so I decided to delete them and then I pressed system files are included and deleted whatever included safari , so later on I tried opening safari and it won't open it says "check with the develo

  • Upgrading SAP-EP(Java) from version 7.0 to 7.1/7.2

    Hi Experts, We have an Application currently working on SAP EP(JAVA) 7.0. We are looking forward to upgrade our EP from 7.0 to higher version (CE 7.1 or CE 7.2). Kindly advise us about issues in this upgrade. Also suggest if upgrade would be better o

  • Calculating Clip Length . . .

    Working with figures has never been my strong point (to put it very mildly) so can anyone help me with this: (Don't laugh)! Let's say I have a clip which is 108 frames long - and I want to slow it down to 80%. How many frames will it be at that speed

  • Disabling IPv6 on 2008R2 Domain Controllers... Best Practice?

    At the end of last year I had a call with Microsoft Support in which I spoke with a member of the Directory Services team regarding an issue.  The issue was resolved with no further problems, but while conversing with the Technical Support Engineer I

  • Is it possible to get a refund on a digital download pre-order.

    As the title says.  I pre-ordered the Destiny Digital Guardian Edition from a Best Buy store on August 1.  I have since had a credit added to my Amazon accout and would like to purchase the DDGE from them instead because that credit makes the game ab