Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Working with Actions, how to avoid creating the 'temp files' or how to close all at once

New Here ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

I am new to actions. I found a script that I was able to alter for my purposes. This essentially searches for a page with a word, and makes a new file with all the pages that come after that word. I run this script, then run a save action, to save them to a folder.


Works great, except this script auto creates 'temp' files inside Adobe, which when I try to close it asks 'Do you want to save this file' and i have to keep clicking no (i could have up to 100 files). Is there a way I can either a) close and say 'don't save any', or b) alter the script to not even create the temp file or c) the best would be to create only a single file from everything I am extracting.

 

Thanks for any help. Script is below.

var pageArray = [];

var stringToSearchFor = "Log";

for (var p = 0; p < this.numPages; p++) {
// iterate over all words
for (var n = 0; n < this.getPageNumWords(p); n++) {
if (this.getPageNthWord(p, n) == stringToSearchFor) {
pageArray.push(p);
break;
}
}
}

if (pageArray.length > 0) {
// extract all pages after the one that contains the string into a new document
var d = app.newDoc(); // this will add a blank page - we need to remove that once we are done
for (var n = 0; n < pageArray.length; n++) {
d.insertPages( {
nPage: d.numPages-1,
cPath: this.path,
nStart: pageArray[n]+1,
nEnd: this.numPages-1,
} );
}

// remove the first page
d.deletePages(0);
}

TOPICS
JavaScript

Views

159

Likes

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
Adobe Community Professional ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

LATEST

This happens when you select to process a folder and it contains non-PDF files. The Action automatically converts those files to PDF, and then runs the rest of the commands on them, and asks if you want to save them. Very annoying.

The solution is to only run it on a folder without any non-PDFs, or to manually select just the files you want to run it on, instead of the entire folder.

Likes

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