I have some simple code to get the %USERNAME%, from Windows XP using
IE7.

******************************************************************
function getUserName() {
         if (!document.all) {
                 alert("Available only with Internet Explorer.");
                 return;
                 }
        var ws = new ActiveXObject("WScript.Shell");
        var un = ws.ExpandEnvironmentStrings("%USERNAME%");
        return un;
        }
alert(getUserName());  // This is just to verify that code works.
******************************************************************

I have tried this using JSNI within inline code, and also by embedding
this code in the HTML file and calling it by JSNI statement
$wnd.getUserName().  I am able to pass & return String values either
way, so JSNI is working for me generally.

When I run this as a "GWT Application" (local, not compiled), the GWT
loader fails w/ "Automation server can not create object," on the line
"...new ActiveXObject..."

However, if I use IE7 to directly File/Open the same HTML (copy/pasted
to a text file) with this JavaScript code, it succeeds.  So the JS
code is functional when called standalone.  But not when passed
through the GWT parser.

My ultimate goal is to pre-set a user's name value on an app page,
based on the local %USERNAME% value.  (Intranet app, security not an
issue, do not want to prompt users to authenticate, no passwords, just
a courtesy, etc.)

Is there a better way to go about this?

Is there a known issue with ActiveXObject creation in GWT?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to