Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Delete duplicate pages of data merge

Community Beginner ,
Mar 10, 2019 Mar 10, 2019

Hello everyone

I'm working on an editorial project to create agendas. I am using data merge to create the pages with calendar data, however due to a project specialty the data merge creates the duplicate pages.

I need to create a script that I can automatically remove from two pages from a page number specified by me.

I tell scrip that two pages he starts deleting, he deletes these two, jumps two and deletes the next two and continues until the document is finished.

Can someone help me?

TOPICS
Scripting
990
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Mar 11, 2019 Mar 11, 2019

Hi,

first things first: create a backup of your document before you run this script.

Second: insert in line 3 the index number of the page from where it should start the deleting process. The index number is 1 less than the page number. For example: if you want to start from page number 5 the value of startPage should be 4.

var doc = app.activeDocument;

var startPage = "insert start value";

var currentPage = startPage;

while (currentPage < doc.pages.length)

{

     doc.pages[currentPage].remove();

     i

...
Translate
Contributor ,
Mar 11, 2019 Mar 11, 2019

Hi,

first things first: create a backup of your document before you run this script.

Second: insert in line 3 the index number of the page from where it should start the deleting process. The index number is 1 less than the page number. For example: if you want to start from page number 5 the value of startPage should be 4.

var doc = app.activeDocument;

var startPage = "insert start value";

var currentPage = startPage;

while (currentPage < doc.pages.length)

{

     doc.pages[currentPage].remove();

     if (currentPage <= doc.pages.length)

          {

               doc.pages[currentPage].remove();

          } else {exit();}

currentPage = currentPage +2;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 11, 2019 Mar 11, 2019
LATEST

Thank you again. The script worked perfectly. My project is ready to be finalized and I owe a lot to you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines