tags:

views:

385

answers:

1

I have JScript method that is :

function init() {
     var userid = System.Environment.getEnvironmentVariable("USERNAME");
     setUserName(userid);
    }

When I debug it , at first line of the init fuction, I'll get "javascript Microsoft JScript runtime error: 'System' is undefined".

I'd be thankful if some one let me know how can I solve it.

Thank you Naseem

A: 

You're using code specific to Windows Sidebar/Desktop Gadgets. The host for Windows Desktop Gadgets provides the System namespace for access to computer properties that are not normally available to Javascript.

Gadgets can be coded in Javascript which is most likely how you picked up that source code. Using this namespace outside of a Windows Desktop Gadget (ie in a web page or shell script) wouldn't work because it is provided by the host (sidebar.exe).

See http://msdn.microsoft.com/en-us/library/ms723688(VS.85).aspx.

Andy E