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
Copy link to clipboard
Copied
What problem do have with the code?
Copy link to clipboard
Copied
None of these are detecting when no more active docs are open.
Copy link to clipboard
Copied
How are you executing the code, exactly?
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.
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.
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.
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.
Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
At this case the function returns nothing.
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