Skip navigation
ax1e2l_b3r4a5s6s
Currently Being Moderated

Applescript: delete object from page

May 15, 2012 12:16 PM

I'm trying to remove an objects from a page with a known name.

 

I've name the object theLine.  It's a drawn line.  Under certain conditions, I want to delete it.

 

Other object is a placed graphic name theImage.  Under certain conditions, I want to delete it as well.

 

Keep trying various iterations, but not even coming close. 

 
Replies
  • Currently Being Moderated
    May 15, 2012 6:55 PM   in reply to ax1e2l_b3r4a5s6s

    Hi

    does this work?

     

     

    tell application "Adobe InDesign CS5.5"

        delete (every graphic line of document 1 whose label is "SolidSigLineTop")

    end tell

     
    |
    Mark as:
  • Currently Being Moderated
    May 16, 2012 1:36 PM   in reply to ax1e2l_b3r4a5s6s

    try this

     

     

    tell application "Adobe InDesign CS5.5"

        set myDoc to active document

        tell myDoc

            try

                set AllGraphicLines to {"SolidSigLineTop", "SolidSigLineBottom"} as string

                set myGraphicline to (every graphic line whose label is in AllGraphicLines)

                delete myGraphicline

            on error

                display dialog "no graphic line/s with this name exists"

            end try

        end tell

    end tell

     
    |
    Mark as:
  • Currently Being Moderated
    May 16, 2012 4:28 PM   in reply to ax1e2l_b3r4a5s6s

    the script assumes that you have a line/stroke on your page and that the stroke is labled in "Script Label", (window/utilities/Script Label), as we

    are looking for it's label   "every graphic line whose label is"  .

     

    you say you've named the layer, very differnt.

     

    to label your stroke, select it, open "window/utilities/Script Label"  enter your strokes name, deslect the stroke, run the script, works fine here

     

    if you need to delete layers, let me no and ill alter the code for you.

     

    kp

     
    |
    Mark as:
  • Currently Being Moderated
    May 16, 2012 4:56 PM   in reply to Kevin Parrott

    heres some code to delete specific layers

     

     

     

    tell application "Adobe InDesign CS5.5"

        activate

        set myDoc to active document

        tell myDoc

            try

                set AllLayers to {"SolidSigLineTop", "SolidSigLineBottom"} as string

                set myLayer to every layer whose name is in AllLayers

                delete myLayer

            on error

                display dialog "no layer/s with this name exists"

            end try

        end tell

    end tell

     
    |
    Mark as:
  • Currently Being Moderated
    May 16, 2012 5:36 PM   in reply to ax1e2l_b3r4a5s6s

    ahh, i see, sorry, try this,  you need ot tell your doc to do what you need it ot do

     

    tell application "Adobe InDesign CS5.5"

        activate

        set myDoc to active document

        tell myDoc

            set theTopRule to the graphic line "SolidSigLineTop"

            set theBottomRule to the graphic line "SolidSigLineBottom"

            delete theTopRule

            delete theBottomRule

        end tell

    end tell

     
    |
    Mark as:
  • Currently Being Moderated
    May 16, 2012 6:34 PM   in reply to ax1e2l_b3r4a5s6s

    give this a spin

     

     

     

    tell application "Adobe InDesign CS5.5"

        activate

        set myDoc to active document

        tell myDoc

            set theTopRule to the graphic line "SolidSigLineTop"

            set theBottomRule to the graphic line "SolidSigLineBottom"

            delete theTopRule

            delete theBottomRule

           

            --delete graphic

            set PlacedImage to rectangle "TEST" -- the image is automatically place in a rectangle

            delete PlacedImage

           

        end tell

    end tell

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points