Skip to main content
Known Participant
December 16, 2022
Question

Script For Removing pages contain links

  • December 16, 2022
  • 4 replies
  • 1396 views

Hi Friends

I want a script that can Extract all pages that contain images links after making data merge in a new indesign file

Or a script to Extract all pages that don't contain images links in a new indesign file

Need help

Thanks

This topic has been closed for replies.

4 replies

ramy5FDAAuthor
Known Participant
December 16, 2022

Any help here

Peter Kahrel
Community Expert
Community Expert
December 17, 2022

You're very impatient. Relax. Help is on the way.

ramy5FDAAuthor
Known Participant
December 18, 2022

I'm So sorry

Community Expert
December 16, 2022

Try the following, it will move the pages of the current document with images onto a new document.

var doc = app.activeDocument;
var page, plst = [];
for (var i = doc.pages.length - 1; i > 0; i--) {
    page = doc.pages[i];
    if (page.allGraphics.length) {
        plst.push(page)
    }
}

if(plst.length)
	var newDoc = app.documents.add()
for(i = 0; i < plst.length; i++){
	plst[i].move(LocationOptions.AFTER, newDoc.pages[-1])
}
if(plst.length)
	newDoc.pages[0].remove()

-Manan

-Manan
ramy5FDAAuthor
Known Participant
December 16, 2022

Thanks For your reply

It only moved  last 10 pages not all pages with links

error message says " Spread cannot have more than 10 pages "

ramy5FDAAuthor
Known Participant
December 16, 2022

Any Help !!

ramy5FDAAuthor
Known Participant
December 16, 2022

Any Help Here 

ramy5FDAAuthor
Known Participant
December 16, 2022

Any Help !!!