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().
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
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
Maybe you can be a bit more specific about what exactly you want to get?
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)
You could use additional Acrobat JS to extract the path or remove the file name and extension.
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
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...
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