Expand my Community achievements bar.

Scripted button to retrieve & display local system information

Avatar

Level 6

Just wondering...has anyone ever programmed a button to retrieve and display local PC info such as:

Computer Make/Model

Serial number

OS

Computer Name

Amount of installed memory

Build Date

Video card type

Current User logged into system

Local Administrators

Installed printers

Default printer

HD drive mappings

ODBC Drivers

I have scripts that were written in Visual basic but need a comparable Javascript solution for Designer

Please advise - thank you in advance.

5 Replies

Avatar

Level 10

Hi,

you cannot retrieve those information with Acrobat's JavaScript except the printer names und the user name.

var l = app.printerNames.length

for ( var i = 0; i < l; i++)

console.println("(" + (i+1) + ") " + app.printerNames[i]);

The user name requires an folder level script as this property need a trusted enviroment be be read.

var UserName = app.trustedFunction(function(doc)

          {        

             app.beginPriv();

 

      var User = this.xfa.form.Form1.Page1.UserNameField1;

      User.rawValue = this.identity.loginName;

 

             app.endPriv();

          });

Avatar

Level 6

Thank you Radzmar,

So you don't think there's a way to retrieve the otehr sought after info (besides printer and user name), via Lifecycle JavaScript even if folder-level JS was used as well?

I know much of this info is contained within the system proprieties - I was just wondering if there was a means of accessing it locally.

Shaun

Avatar

Level 10

Hi,

I am not sure if you will be able to access all of the information, but accessing information like the current user would be considered a security concern.

You could need a trusted function, which is script in a JavaScript file that is placed in the Acrobat folder of EVERY computer accessing the form.

You can do a search for trusted function on the forums, but here are a few:

http://forums.adobe.com/message/2189021#2189021

http://forums.adobe.com/message/2366415#2366415

http://forums.adobe.com/message/2326803#2326803

Hope that helps,

Niall

Avatar

Level 6

Hi Niall,

I certainly follow you on this...

But qick question... I grasp the concept, but is the trusted function always the same, or does it vary based on what you're trying to accomplish?

So...is the function contained within the js universal (always the same script), or does it change?

Shaun

Avatar

Level 6

Oops, I think I've discovered the answer to my own question.

In looking at Radzmar's example, i see he contained the "custom script" within the trusted js (below). So it changes...!

   var User = this.xfa.form.Form1.Page1.UserNameField1;
      User.rawValue = this.identity.loginName;