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

Action Wizard - Insert pages based on the name of the original file

Explorer ,
Apr 18, 2024 Apr 18, 2024

Copy link to clipboard

Copied

I am trying to build an Action Wizard but, what I am trying to do might be solved by a Jave Script.

I have a bunch of files with names like LUM08900361.pdf and another file with two pages named LUM08900361_GIS.pdf. I would like to be able to combine these two files. The LUM08900361_GIS.pdf will be the last two pages in the LUM08900361.pdf file.

 

The problem I have and cannot figure out how to do is, I have to do this same step for 170 files.

So the files that go together would be like:

LUM08900361.pdf <-- Insert at end LUM08900361_GIS.pdf and save and overwrite the first file LUM08900361.pdf after insertion. then move to the next file.

LUM08900362.pdf <-- Insert at end LUM08900362_GIS.pdf and save and overwrite the first file LUM08900362.pdf after insertion. then move to the next file.

LUM08900363.pdf <-- Insert at end LUM08900363_GIS.pdf and save and overwrite the first file LUM08900363.pdf after insertion. then move to the next file.

etc.... for a total of 170 files.

 

Also, the _GIS.pdf files will be stored in a different directory from the original file.

My directory structure is setup like this:

C:\GIS\Reports\LUM08900361.pdf

C:\GIS\GIS Files\LUM08900361_GIS.pdf

 

The action Wizard seems to me to be the best choise because it will let me choose the whole folder of files. If this works with a Java Scipt I would also be happy.

 

I have included files to work with.

Thanks

TOPICS
How to , JavaScript , PDF forms

Views

334

Translate

Translate

Report

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 Expert ,
Apr 18, 2024 Apr 18, 2024

Copy link to clipboard

Copied

Is the relation between the two file names that the second file is always the same as the first one, just with "_GIS" added to the end of it?

Votes

Translate

Translate

Report

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
Explorer ,
Apr 22, 2024 Apr 22, 2024

Copy link to clipboard

Copied

LATEST

Yes that is correct.

Votes

Translate

Translate

Report

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 Expert ,
Apr 18, 2024 Apr 18, 2024

Copy link to clipboard

Copied

If the answer to try67's question is Yes, then you could write an "Action" script to merge the PDFs.

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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
New Here ,
Apr 20, 2024 Apr 20, 2024

Copy link to clipboard

Copied

I would also like to do what the OP is suggesting. I am looking at writing a script using 

this.insertPages({nPage:0, cPath:"InsertExampleSource.pdf"});

but I'm a bit stuck as to how one might vary the value of cPath for each instance of the batch process. In other words, use "LUM08900361_GIS.pdf" when processing the file "LUM08900361.pdf". Can a variable be defined for the cPath? Sorry, I'm really new to scripting.

Votes

Translate

Translate

Report

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 Expert ,
Apr 20, 2024 Apr 20, 2024

Copy link to clipboard

Copied

Yes, you can, like this:

 

this.insertPages({nPage:0, cPath: this.path.replace(".pdf", "_GIS.pdf")});

 

And if the other files are located in a different folder (as mentioned in the original question), then you can use something like this:

 

this.insertPages({nPage:0, cPath: "/C/GIS/GIS Files/" + this.documentFileName.replace(".pdf", "_GIS.pdf")});

 

Votes

Translate

Translate

Report

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