javascript erase all from pasteboard

189 views
Skip to first unread message

Michel Raj

unread,
Feb 18, 2013, 12:33:01 PM2/18/13
to indesi...@googlegroups.com
I had this script going well in CS4 and 5, but in CS6, it erases everything, not only from the pasteboard, but also from the pages, except the items from the master pages.
Can someone tell me what changed ?

Michel



var doc = app.documents[0];
items = doc.pageItems;
for(var i=items.length-1;i>=0;i--){
if(items[i].parent instanceof Spread){items[i].remove()}

Rick Gordon

unread,
Feb 18, 2013, 10:52:33 PM2/18/13
to indesi...@googlegroups.com
I'm not sure of the JS syntax, as I mostly AppleScript InDesign, but get the objects as you did, and also query them for their parent page (parentPage?). If it is nothing (null?), then it's on the pasteboard.

Rick Gordon

------------------

On 2/18/13 at 6:33 PM +0100, Michel Raj wrote in a message entitled
"[ID] javascript erase all from pasteboard":
--
___________________________________________________

RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________________

WWW: http://www.shelterpub.com

Rick Gordon

unread,
Feb 18, 2013, 10:57:58 PM2/18/13
to indesi...@googlegroups.com
So I'll guess this as the code line:

if (items[i].parent instanceof Spread && (items[i].parentPage == null) {items[i].remove()}

------------------

On 2/18/13 at 7:52 PM -0800, Rick Gordon wrote in a message entitled
"Re: [ID] javascript erase all from pasteboard":
>--
>You received this message because you are subscribed to the Google Groups "InDesign talk" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to indesign-tal...@googlegroups.com.
>To post to this group, send email to indesi...@googlegroups.com.
>Visit this group at http://groups.google.com/group/indesign-talk?hl=en.
>For more options, visit https://groups.google.com/groups/opt_out.

Rick Gordon

unread,
Feb 18, 2013, 11:00:26 PM2/18/13
to indesi...@googlegroups.com
Actually, probably just this would do:

if (items[i].parentPage == null) {items[i].remove()}


------------------

On 2/18/13 at 7:57 PM -0800, Rick Gordon wrote in a message entitled
"Re: [ID] javascript erase all from pasteboard":

>So I'll guess this as the code line:
>
>if (items[i].parent instanceof Spread && (items[i].parentPage == null) {items[i].remove()}
>

Michel Raj

unread,
Feb 19, 2013, 3:00:25 AM2/19/13
to indesi...@googlegroups.com
Thank you Rick, this works !

Have a nice day
Michel
Reply all
Reply to author
Forward
0 new messages