7 Replies Latest reply on Apr 21, 2012 11:30 AM by FUBARinSFO

    Access to workstation name

    FUBARinSFO Newcomer


      Is there a way to access any "system" variables with Acrobat JavaScript?  I haven't been able to find anything (other than Date()) in the references.  This is outside the scope of core JavaScript, as far as I know.


      In particular, I want to be able to pluck the workstation name string and insert it in a footer.


      Thank you in advance.


      -- Roy Zider

        • 1. Re: Access to workstation name
          try67 Legend

          There isn't a direct way to do that, but I think it might be possible by

          smartly manipulating the various results provided by app.getPath().

          • 2. Re: Access to workstation name
            FUBARinSFO Newcomer

            Maybe, but unlikely.  'path' itself is a misnomer, since it delivers both path and filename.  And fails to report the drive.


            It occurs to me that maybe a better approach to this whole thing is to do the pdf manipulation from Windows Scripting Host.  Then at least all the file and system information will be available. 


            I haven't looked at LiveCycle or xfa or SOAP or other possible technologies.  I understand ADBC was dropped from Adobe X.  It would have provided a simple way to read or import an external file with the information of interest, that could then be added to a header/footer.


            -- Roy Zider

            • 3. Re: Access to workstation name
              try67 Legend

              I'm not talking about path, which returns the full path of a file

              (including the drive letter, by the way), but about app.getPath() which can

              return various system- and user-level folders used by Acrobat. Many times

              these contain the name of the currently logged-in user, as well as some

              other information.

              Maybe you can be a bit more specific about what exactly you want to get?

              • 4. Re: Access to workstation name
                gkaiseril Ninja

                With Acrobat JS not the workstation ID. File paths and URL for a  PDF stored on a network drive is possible:


                console.println("\nthis.URL:\n" + this.URL);
                console.println("\nthis.path:\n" + this.path)



                /ORDHOME.CHICAGO.ISRWORLDWIDE.COM/GEORGE$/My DocumentsISR/Adobe/Console.pdf



                You could use additional Acrobat  JS to extract the path or remove the file name and extension.

                • 5. Re: Access to workstation name
                  FUBARinSFO Newcomer



                  I'd be interested in seeing how you get the drive letter from 'this.path'.  I've not been able to do it.


                  The function app.getPath() returns the dpath (drive-path) of various folders created during installation. I didn't see any reference in the API to any system information.


                  What I'm trying to do is very simple: in a footer, I want to post the workstation name of the host that's stamping the pdf.  So, '[MPX2] D/My Documents/test logs.pdf' and '[K7N] D/My Documents/test logs.pdf' for workstations MPX2 and K7N, bzw.


                  -- Roy Zider

                  • 6. Re: Access to workstation name
                    try67 Legend

                    this.path.substring(1,2) will return the drive letter where the current

                    file is located.

                    I don't think you can get the local name of the workstation using

                    app.getPath(), though. You can get the name of the current user...

                    • 7. Re: Access to workstation name
                      FUBARinSFO Newcomer



                      You are so right.  Substring not necessary (but good reminder of another method).  I misread my own system. 


                      I've got three workstations active; on one of them[MPX2]  the drive assignments are simple: C: and D;  on another [K7N] the directories are treed: D:\D, D:\E, D:\F, and so forth.  I read /D/MyDox/<filename> as being on the K7N workstation with the 'virtual' sub-drive directory structure, when in fact I was on the other workstation (MPX2)   I had lost track of which system I was woking with. 


                      Sorry for any inconvenience, and thank you for bucking this back to me.


                      -- Roy Zider