PDF Automation Station

PDF Automation Station

When 'Create Multiple Copies' Runs Out of Space

Use this trick to create multiple copies of fields across multiple pages.

David Dagley's avatar
David Dagley
May 13, 2025
∙ Paid
Share
blue and silver round steel containers
Photo by Eric Prouzet on Unsplash

I notice a lot of questions on the Acrobat Users Forum have examples of fields in rows where the field names contain numbers without periods.

Numbered fields like this are handy for writing scripts that loop through all the fields containing the non-number part of the field name and do something to those fields. For example, you could format the dates for all the date fields, or add a border to all the tax fields, or use the fields in a calculation without naming them all individually in your script. The screenshot above only contains three rows so it’s not a big deal to name the fields in your script, but imagine if there were 25, or 50, or any other number higher than 50. It’s a lot of work that is prone to errors.

Get the course above, and a suite of automation tools for FREE with a Professional subscription.

The following scripts loop through the fields and do something with each field (assumes 25 fields):

// 1. Format the Date fields
for(var i=1;i<=25,i++)
{
this.getField("Date"+i).setAction('Format','AFDate_Format("mm/dd/yyyy")');
this.getField("Date"+i).setAction('Keystroke','AFDate_Keystroke("mm/dd/yyyy")')
}

// 2. Change the border color of the Tax fields to black
for(var i=1;i<=25;i+++)
{
this.getField("Tax"+i).borderColor=color.black;
}

/* 3. Count how many Amount fields contain a value and display that total in a field*/
var count=0;
for(var i=1;i<=25;i++)
{
if(this.getField("Amount"+i).value)
{count++;}
}

event.value=count;

To modify the scripts above for a different number of rows, change 25 to the number of rows.

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 David Dagley
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture