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

Run an Action only on files in a folder with file names that begin with "PDF"

New Here ,
May 20, 2016 May 20, 2016

I want to run an Adobe Action, on a network folder where copiers save scanned files, to remove PDF/A from files that will have it. I know the files will all begin with "PDF" due to the HP scanner software naming convention. I don't want to run on all files since there are scanned files from multiple machines and only the HP gives us PDF/A. It wouldn't be a big deal to run on all, but the action changes the date file was modified, so it makes all the files appear to have be scanned at the same time, which is confusing when people are used to finding a file by the time it was scanned. I think javascript is the way to go for this, but I may be way off. I'm new.

Acrobat Pro 10. Win 7.

TOPICS
Acrobat SDK and JavaScript
1.1K
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

Community Expert , May 20, 2016 May 20, 2016

You can do it if you save the file using JS. Use this code:

if (/^PDF/.test(this.documentFileName)) this.saveAs(this.path);

Make sure not to add a separate Save command, of course.

Translate
Community Expert ,
May 20, 2016 May 20, 2016

You can do it if you save the file using JS. Use this code:

if (/^PDF/.test(this.documentFileName)) this.saveAs(this.path);

Make sure not to add a separate Save command, of course.

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
New Here ,
May 24, 2016 May 24, 2016

Hmmm.

I removed the save command from the action and added the code as written

(cut & paste) but now no files are updated. Do I need to change the code to

specify where to save? Thank you for your assistance - it's much

appreciated.

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 Expert ,
May 24, 2016 May 24, 2016

No, it should work as is... Are you sure your files actually begin with "PDF" (in upper-case)?

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
New Here ,
May 24, 2016 May 24, 2016

Yes. As an example, one file is PDF0024-01.pdf

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 Expert ,
May 24, 2016 May 24, 2016

Are there any error messages in the console?

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
New Here ,
May 24, 2016 May 24, 2016

No, it runs fine, I can see the action performing on all files in the

folder - I see the file names stream by.

Only thing I can think is maybe the script is not saving the files to the

network folder where they were opened from?

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
New Here ,
May 24, 2016 May 24, 2016

Temp files were being created

at D:\Users\myprofilename\AppData\Local\Temp\Preflight Acrobat 10\Batch

A temp folder would be created, with a sub-folder for each PDF that action

was ran on. I was able to copy and past the folders when script running -

otherwise, at end of script, they were gone. That's probably just the

preflight itself creating those files - still not sure if/where the final

copies are saved to.

Searching for the file, PDF0024-01.pdf I don't see anywhere other than my

recent files and original network folder.

On Tue, May 24, 2016 at 5:57 PM, Peter Moses <peterrabbittask@gmail.com>

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 Expert ,
May 24, 2016 May 24, 2016

Are the files you're processing PDF files, or another format?

On Wed, May 25, 2016 at 1:20 AM, TheOneWhoKnocks1 <forums_noreply@adobe.com>

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
New Here ,
May 25, 2016 May 25, 2016

Only PDFs. In the Action wizard, I deselected all other file types so it

would run faster. I even tried renaming one of the files to "PDF.pdf" to

see if that would work but still no modified file saved in the shared drive

after running.

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
New Here ,
May 25, 2016 May 25, 2016

I got it, thanks so much for your help.

if (/^PDF/.test(this.documentFileName))

this.saveAs("/d/users/myprofile/desktop/adobe/"+ this.documentFileName);

Now I'm trying to figure out the inverse - the action causes the preflight

to running on all PDFs in the folder, but it only saving the ones that

begin with PDF. It would be faster if it did not preflight the other files

and skipped over them. I figure I can put some code before the preflight

action to return to top of java code if file doesn't start with "PDF".

On Wed, May 25, 2016 at 3:08 PM, Peter Moses <peterrabbittask@gmail.com>

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 Expert ,
May 25, 2016 May 25, 2016
LATEST

Change

if (/^PDF/.test(this.documentFileName))

To

if (/^PDF/.test(this.documentFileName)==false)

On May 26, 2016 4:26 AM, "TheOneWhoKnocks1" <forums_noreply@adobe.com>

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