-
1. Re: Applescript: delete object from page
ax1e2l_b3r4a5s6s May 15, 2012 4:04 PM (in response to ax1e2l_b3r4a5s6s)Disregarding the object and focusing on the lines, i keep trying iterations of this, but to no avail:
tell application "Adobe InDesign CS5.5"
set theTopRule to the graphic line "SolidSigLineTop"
set theBottomRule to the graphic line "SolidSigLineBottom"
if theSigLineCount = 2 and theSigMicroPrint = "Y" then
delete theTopRule
delete theBottomRule
end if
end tell
results in:
error "Adobe InDesign CS5.5 got an error: Can’t get graphic line \"SolidSigLineTop\"." number -1728 from graphic line "SolidSigLineTop"
-
2. Re: Applescript: delete object from page
Kevin Parrott May 15, 2012 6:55 PM (in response 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
-
3. Re: Applescript: delete object from page
ax1e2l_b3r4a5s6s May 16, 2012 7:08 AM (in response to Kevin Parrott)No. No error, but no deletion.
Also tried
delete (every graphic line whose label is "SolidSigLineTop")
and
delete (graphic line "SolidSigLineTop")
Still not working.
-
4. Re: Applescript: delete object from page
Kevin Parrott May 16, 2012 1:36 PM (in response 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
-
5. Re: Applescript: delete object from page
ax1e2l_b3r4a5s6s May 16, 2012 4:01 PM (in response to Kevin Parrott)got the display dialog error in the on error portion of the try statement!
Is the line I drew on the page not a graphic line?!?!?!??!??!
I guess the other option is that the name is not right. I named the element under the layers, the same way I did with some Text Rectangles, etc. Assumed that was right.
-
6. Re: Applescript: delete object from page
Kevin Parrott May 16, 2012 4:28 PM (in response 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
-
7. Re: Applescript: delete object from page
Kevin Parrott May 16, 2012 4:56 PM (in response 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
-
8. Re: Applescript: delete object from page
ax1e2l_b3r4a5s6s May 16, 2012 5:05 PM (in response to Kevin Parrott)I wasn't very clear - sorry.
I named the item under the layer.
Layer 1 in the layers window, expanded it, shows all the elements.
Named the items there. In this case, renamed the reference to the line.
Then I can manipulate each element by it's name.
I've used this with text rectangles tons, and it works fine. Never heard of the script label. Must be different for lines?
-
9. Re: Applescript: delete object from page
Kevin Parrott May 16, 2012 5:36 PM (in response 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
-
10. Re: Applescript: delete object from page
ax1e2l_b3r4a5s6s May 16, 2012 5:43 PM (in response to Kevin Parrott)Wonderful. Sorry about the lack of clarity. Applescripting applications has me more than a little confused. Works, of course, now that I explained it completely!
What is the reference for an object placed on the page?? (tiff file added using the place command)
I need to perform the same function to that object as well - possible deletion.
Thanks again. This forum is EXCELLENT!
-
11. Re: Applescript: delete object from page
Kevin Parrott May 16, 2012 6:34 PM (in response 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