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

How figure out when there are no more active docs

Explorer ,
Aug 27, 2017 Aug 27, 2017

Copy link to clipboard

Copied

HI,

I want to use app.activeDocs to detect when there are no more active pdf's.  I tried putting:

if (dd.length == 0)

if (dd.length == null)

if (dd.length == false)

if (dd.length <1)

if (dd.length !=1)

into the following code:

{

   app.beginPriv();

var dd = app.activeDocs

if (dd.length ==0)

{

app.alert ("hi")

}

     app.endPriv();

   });

Note I cannot use folder level scripts as I am unable to get permission to put on user's computers.

Using Acrobat X Pro

TOPICS
Acrobat SDK and JavaScript , Windows

Views

682

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 ,
Aug 27, 2017 Aug 27, 2017

Copy link to clipboard

Copied

What problem do have with the code?

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 ,
Aug 27, 2017 Aug 27, 2017

Copy link to clipboard

Copied

None of these are detecting when no more active docs are open.

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 ,
Aug 27, 2017 Aug 27, 2017

Copy link to clipboard

Copied

How are you executing the code, exactly?

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 ,
Aug 27, 2017 Aug 27, 2017

Copy link to clipboard

Copied

Hi,

I do not have option of adding folder level scripts to user's computers.  This needs to be self contained within action wizard user imports into Adobe.

I want to figure out when there are no active documents and then delete the global variable.

Here is the code I am trying to use:

var dd = app.activeDocs

if (dd.length ==0)

{

delete global.DoNumAction

app.alert ("it worked")

}

It is not working though.  I get no app alert after there are no more active documents.

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 ,
Aug 27, 2017 Aug 27, 2017

Copy link to clipboard

Copied

You can't. A folder level script is required in order to create a privileged function to return the actual number of active documents.

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 ,
Aug 27, 2017 Aug 27, 2017

Copy link to clipboard

Copied

That doesn't make sense. The entire point of an Action is that it opens a file and then performs some actions on it, so activeDocs will never be empty if you use it in that context.

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 ,
Aug 27, 2017 Aug 27, 2017

Copy link to clipboard

Copied

I understand that point of action wizard is to perform actions on documents.  I am trying to figure out how perform one last action after all actions have been performed (i.e. No active documents) So I can clear the global variable.  I have  do this without using a folder level script bc that is not an option for me.

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 ,
Aug 27, 2017 Aug 27, 2017

Copy link to clipboard

Copied

LATEST

Not possible. The Action ends when the last file is done being processed.

On Sun, Aug 27, 2017 at 10:44 PM, sargums46564804 <forums_noreply@adobe.com>

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 ,
Aug 27, 2017 Aug 27, 2017

Copy link to clipboard

Copied

At this case the function returns nothing.

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
LEGEND ,
Aug 27, 2017 Aug 27, 2017

Copy link to clipboard

Copied

You should be able to get to the user's JavaScript folder since this where users add stamps through the manage stamps. You may need to create the user JavaScript folder.

For Acrobat/Reader DC:

C:\Users\[userid]\AppData\Roaming\Adobe\Acrobat\Privileged\DC\JavaScripts

You need to adjust for userid. Note the "AppData" folder is a system directory and hidden. If you open Windows Explorer and enter the environmental symbol "%appdata%" in the address line you will be able to see the AppData/Roaming folder contents and you need to add the "Privileged\DC\JavaScripts" folders and place your code in the Adobe folder.

For Acrobat X you need to change the "DC" folder to "10.0"

JavaScript Changes for Acrobat X and Reader X, version 10.1.1

http://blogs.adobe.com/pdfdevjunkie/2011/09/javascript-changes-for-acrobat-x-and-reader-x-version-10...

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