6 Replies Latest reply on Feb 19, 2013 3:26 PM by gkaiseril

    Finding the privledged folder?  Adobe XI pro on XP

    scifiguy20904

      I've got the following code:

       

      myTrustedSaveAs = app.trustedFunction( function ( doc, path )
      {
      app.beginPriv();
      doc.saveAs({
      cPath: path,
      bCopy: true,
      bPromptToOverwrite: true
      });
      app.endPriv();
      });
      myTrustedOpenDoc = app.trustedFunction( function ( path )
      {
      app.beginPriv();
      app.openDoc({
      cPath: path
      });
      app.endPriv();
      })

       

      C:\Documents and Settings\my.name\Application Data\Adobe\Acrobat\Privileged\11.0\JavaScripts\init.js

       

      When I try to call the function in my PDF, it says the funciton is not defined.

       

      Is there somewhere else this file needs to be?

       

      More generally, our users have a number of combinations of Adobe reader 9-11, writer 9-11 on XP and Windows 7.

      Is there someplace which lists where all the privledged folders are supposed to be?   If not, a funciton in Adobe to provide the path would sure be useful...

        • 1. Re: Finding the privledged folder?  Adobe XI pro on XP
          George_Johnson MVP & Adobe Community Professional

          Did you restart Acrobat after installing the file? You should be able to see what folder-level code is available in the JavaScript debugger (Ctrl+J) if you've enabled it in your JavaScript preferences. (Edit > Preferences > JavaScript > Enable JavaScript debugger...)

          • 2. Re: Finding the privledged folder?  Adobe XI pro on XP
            gkaiseril MVP & Adobe Community Professional

            You can open the JavaScript console in Acrobat or Reader and use the following JavaScript in the console to locate the user Acrobat JavaScript folder:

             

            app.getPath("user","javascript");

             

            Entering Folder Level Scripts by Thom Parker for more information for version 4 - 9.

            User JavaScript Changes for 10.1.1 (Acrobat | Reader) for changes with Acrobat 10.1.1

            How to Use the JavaScript Debugger with Adobe Reader

             

            You should also be aware that there is one folder for privileged scripts for both Reader and Acrobat, so if you have both installed on your system you may have to modify the scripts that are Acrobat only, have code that Reader cannot execute, to selectively install the code based on the product being used.

            • 3. Re: Finding the privledged folder?  Adobe XI pro on XP
              scifiguy20904 Level 1

              I tried the following in init.js:

               

              myTrustedJavaScriptPath = app.trustedFunction( function (  )

              {

              app.beginPriv();

              console.clear();

              app.getPath("user","javascript");

              console.show();

              app.endPriv();

              });

               

              When I call the function, all I get is the console. There is no informaiton inside it.  Is there something more that needs to be added to have it show the folder?

              • 4. Re: Finding the privledged folder?  Adobe XI pro on XP
                Bernd Alheit Adobe Community Professional & MVP

                Execute the function in the console.

                • 5. Re: Finding the privledged folder?  Adobe XI pro on XP
                  try67 MVP & Adobe Community Professional

                  You need to output the path to the console, like this:

                  console.println(app.getPath("user","javascript"));

                  • 6. Re: Finding the privledged folder?  Adobe XI pro on XP
                    gkaiseril MVP & Adobe Community Professional

                    What was the exact directory name where you placed the file?

                     

                    What version of Acrobat are you using?

                     

                    From the provided links:

                     

                    Changes for 10.1.1

                     

                     

                    By design, Acrobat processes do not write to the %ApplicationData%\ Acrobat\Privileged\10.0 folder. Additionally, sandboxed processes are specifically prohibited from writing to that folder. Thus, the most secure operation involves enabling Protected View in Acrobat and Protected Mode in Reader and thereby sandboxing all processes. Additionally, 10.1.1 introduces the following changes:

                    • New user JS location: The user JavaScript folder is moved from 
                      • Vista and Windows 7:Users\(username)\AppData\Roaming\Adobe\Acrobat\10.0\JavaScripts to Users\(username)\AppData\Roaming\Adobe\Acrobat\Privileged\10.0\JavaScripts. For example, the new path might be C:\Users\JoeUser\AppData\Roaming\Adobe\Acrobat\Privileged\10.0\JavaScripts
                      • XP: Documents and Settings\(username)\Application Data\Adobe\Acrobat\10.0\JavaScripts to Documents and Settings\(username)\Application Data\Adobe\Acrobat\Privileged\10.0\JavaScripts. For example, the new path might be: C:\Documents and Settings\JoeUser\Application Data\Adobe\Acrobat\Privileged\10.0\JavaScripts
                      Note: This is a Windows-only change. Also, the change does not impact the behavior of C:\Program Files\Adobe\(product name and version)\(product name)\JavaScripts. 

                    • New format and location for persistent global variables: Variable settings stored in glob.settings.js and glob.js now reside in a new directory at %ApplicationData%\Adobe\Acrobat\10.0\JSCache. The key value pairs read from the ASCab are used to initialize the persistent global variables. No settings are saved as JavaScript files in this directory.

                     

                    If you missed for XP:

                     

                    • XP: Documents and Settings\(username)\Application Data\Adobe\Acrobat\10.0\JavaScripts to Documents and Settings\(username)\Application Data\Adobe\Acrobat\Privileged\10.0\JavaScripts.
                    • For example, the new path might be: C:\Documents and Settings\JoeUser\Application Data\Adobe\Acrobat\Privileged\10.0\JavaScripts

                    If you have version 11 then change "10.0 "to "11.0".

                     

                    you could add an "app.alert("Starting custom function");" to you file and see if it executes. You will have to restart Acrobat for the script to start.

                     

                    Are you getting any errors on the JavaScript console?

                     

                    "my.name" cannot be your login name. Make sure you have spelled your login name correctly including capitalization.