3 Replies Latest reply on Dec 19, 2010 12:20 AM by maxwyss

    How do I process all the files in a folder simply?


      I need some help with a task I’m working.  I need to access a folder filled with 50+ PDF files and put password protection on each one.  The files will have specific 6-character names and I want each file to always get the same password.  This task would run twice monthly.

                      So far I have a working solution with a flaw.  In ADOBE Acrobat professional, I created a separate security policy for each of the 6-character names, assigning each a password.  Using Batch Processing, I run a JavaScript program to password-protect the files.  This process works okay, but the flaw is the need for excess manual processing.  I want the process to spin through the files without any further confirmations from me.  As it is, I have to push the OK button once for every file in the folder.  This is inconvenient.  Is there a way I’m missing to accomplish my goal.

                      The script I’m using follows:


      /* Applying a Security Policy to a PDF Document */

      var ASISecurityAll = app.trustedFunction(



      var oMyPolicy = null;

      var rtn = null;

      var sPolNam = "ASI000";


      // First, Get the ID of SimplePassword security policy

      var aPols = security.getSecurityPolicies();

      var fnm = this.documentFileName;

      var fnm6 = fnm.substr(0,6);

      var sPolNam = "ASI000";

      sPolNam = "ASI" + fnm6.substr(3,3);

      for(var i=0; i<aPols.length; i++)


           if(aPols[i].name == sPolNam)


                oMyPolicy = aPols[i];

                rtn = this.encryptUsingPolicy({oPolicy: oMyPolicy });








      Thanks for assistance.