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

Filename Stamper

Engaged ,
May 22, 2017 May 22, 2017

I'm trying to use an action by Rick Borstein called "Filename Stamper" (File_Name_Stamper.sequ) which is totally awesome (thanks Rick!), but requires that I click OK every time for each document when I have selected multiple files with the file open dialog box. This got a little tedious after the first few hundred - is there a way around this?@

TOPICS
Acrobat SDK and JavaScript
3.2K
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 22, 2017 May 22, 2017

What is the dialog box asking you to confirm, exactly?

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
Engaged ,
May 22, 2017 May 22, 2017

Here it is: https://acrobatusers.com/actions-exchange/file-name-stamper-for-acrobat-xi

The javascript window pops up and you click "Apply" for each one of the 'N' documents you selected, which is a total bummer if N=1000!

Screen Shot 2017-05-22 at 15.54.50.jpg

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
Engaged ,
May 22, 2017 May 22, 2017

I should add I've tried using various keys such as control, option etc. as sometimes in MacOS these lead to OK being changed to "OK to all" etc. Wondering if Acrobat has any similar tricks.

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 22, 2017 May 22, 2017

What version of Acrobat are you using?

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
Engaged ,
May 22, 2017 May 22, 2017

The very latest cloud version. The action works beautifully, it's just this issue with having to "Apply" to every file.

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
Engaged ,
May 22, 2017 May 22, 2017

I've just seen in the docs that you can edit the action ... I think it's a case of more research into actions to find out how to get it to just process everything that's open, that would work for me. I'd thought it was a sort of self-enclosed script.

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 22, 2017 May 22, 2017

Something to try: Go to Edit - Preferences - JavaScript and make sure that "Enable global object security policy" is NOT ticked.

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
Engaged ,
May 22, 2017 May 22, 2017

I unchecked that, seems to be the same. There's a massive piece of javascript in the action. I think it's a case of modifying that to simply process all open docs. I'll need to study it for some time, it\s not something I've spend a lot of time doing. I've only ever hacked at stuff like this to mod it (just, this is the biggest I've seen!)

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 22, 2017 May 22, 2017

That's what the Action does. The code should save the selected values once and then use them for the rest of the files processed by the Action. If that's not what it's doing it will need to be adjusted to do so. I had assumed that's how it worked, as it makes the most sense, but didn't go into it very deeply, so I can't say for sure.

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 22, 2017 May 22, 2017

Gilad and Zimbop, the issue with action scripts is that the DOM provides no info about the file's order in the process. The script doesn't know if a file is the first in the process, or the last.  Since the JavaScript model doesn't provide any info on this, then you have to create some method for detecting the first document. That's the trick.

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

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 22, 2017 May 22, 2017

Hi Thom,

Why is it important to know which file is being processed? You just need to check if the global object exists (which you already do in the code). If it doesn't, display the dialog and collect the settings from the user. If it does, use the values from it.

The only potential downside is that if the Action is then run again it will use the same settings, but there are ways around that too (like adding a menu item to reset those settings, or simply by restarting Acrobat).

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 22, 2017 May 22, 2017

Yes, you could add a menu or toolbar button, or a command, to set the options, but then you'd have both the action plus this thing. I find a better method is to create a summary document. That way the code is all contained in the action, much easier for the user to install. And the summary document is a visual reminder that everything processed is using the same parameters.  As well as containing some useful info. For example, it can show status for document that can't be processed if there is security on the doc, or is XFA.

The current code only checks the globals so it doesn't have to recreate the dialog each time.

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

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 22, 2017 May 22, 2017

Isn't that the issue, though? That it does show the dialog for each file...?

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 22, 2017 May 22, 2017
LATEST

The global isn't for showing the dialog, its for defining the dialog object. 

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

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 22, 2017 May 22, 2017

Hello Zimbop,  I'm the original author of that Action. I wrote it for Rick.  And you are not the first person to ask for the dialog to only come up once. And I created that variation. So if your interested, send me an email.  thomp@windjack.com

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

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