5 Replies Latest reply on Jul 17, 2008 11:24 AM by (Mike_J_B)

    Client (Document-Level?) Javascript

    Level 1
      I have a server application that requires (client-side?) javascript. By this I mean, I need to deploy a javascript file into

      C:\Program Files\Adobe\[version]\[product]\Javascripts

      So when a user goes to a page in the server application, a prompt will appear "Install Javascript into Acrobat/Reader ?"

      If the user clicks yes, it will download an executable that will deploy the javascript file to the appropriate directory.

      This needs to work on both the PC and the Mac.

      Are there any tools out there that will facilitate doing this?
        • 1. Re: Client (Document-Level?) Javascript
          Patrick Leckey Level 3
          > Are there any tools out there that will facilitate doing this?

          Nothing from Adobe. This may be possible on Windows with an ActiveX control in IE, but due to security you're SOL on a Mac or if the user happens to use Firefox.
          • 2. Re: Client (Document-Level?) Javascript
            Level 1
            I disagree. You could write an AppleScript or AppleScript application that calls a shell script to install the client side script in the appropriate directory. You could also write it so that the user needs to provide admin credentials to install if you would like or need to do so.

            Also note that on Win XP IE 6 and IE 7 block ActiveX controls unless you approve their installation. On Vista it's a matter of fact unless you disabled UAC.

            Sabian
            • 3. Re: Client (Document-Level?) Javascript
              Patrick Leckey Level 3
              > Also note that on Win XP IE 6 and IE 7 block ActiveX controls unless you approve their installation

              Well I should hope so. That's the whole point - otherwise you would have unlimited access to the local filesystem. I didn't include that in my post as I didn't think it needed to be mentioned.

              > it will download an executable that will deploy the javascript file to the appropriate directory.

              I didn't see this in the original message. I though he wanted everything hosted on the website, so when the user clicked OK it would deploy the actual file, not basically download an installer.

              Yes, going the "click on OK to download an installer" route is very possible for both Mac and PC.
              • 4. Re: Client (Document-Level?) Javascript
                Level 1
                Awesome, I'll try that. Thanks!
                • 5. Re: Client (Document-Level?) Javascript
                  Level 1
                  The js api reference says that the Annotation object was introduced in Acrobat 7.0. This is necessary for what I'm working on, therefore I can simply ignore versions older than 7.

                  I have an applescript file working that will find the javascript file for Reader 8.0 and output a text file there. This is the path for Reader 8.0:

                  /Applications/Adobe Reader 8_/Adobe Reader.app/Contents/MacOS/Javascripts

                  I probably have to support all versions of Reader, Acrobat, and Professional greater than 7.0.

                  Right now, my plan to do this is to simply match subdirectories of /Applications based on the keywords "Adobe" "Reader" "Acrobat" until I find the .app directory, and then check the subdirectory path. This might be unreliable..

                  Any chance there's an easier way to find the javascripts directory? For example, on windows I can check the adobe install directory in the registry, and then just find the appropriate subdirectory.