ActiveX control and using it in Javascript & Vbscript to add key value in the Registry.

ActiveX is a client-side technology only. It is designed to allow COM objects registered on the client machine to be instantiated in the browser. ActiveX controls can be used in clientside applications running in a web browser. When the user accesses a web page, the control is downloaded to the client machine and is run from the browser using a scripting language such as Javascript or VBScript.

Ex: To uncheck delete browsing history on exit checkbox in IE

<html>
<head>

<script language=”javascript” type=”text/javascript”>
function Prevent() {

try {
var wsh = new ActiveXObject(“WScript.Shell”);
var key = “HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Privacy\\ClearBrowsingHistoryOnExit”;
wsh.RegWrite(key, 0, “REG_DWORD”);
alert(“Disabled delete browsing history on exit.”);
}
catch (e) {
alert(“Delete browsing history on exit is not enabled.”);
}
}
</script>
</head>
<body onload=”Prevent()”>
</body>

</html>

In Vbscript:

<head>
<script type=”text/javascript”> var foobar = false; </script>  //Important since javascript is there by default.
<script type=”text/vbscript”>
sub testmePlease()
s_RegPath=”HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Privacy\ClearBrowsingHistoryOnExit”
set o_WScript=createobject(“WScript.shell”)
o_WScript.RegWrite s_RegPath,1,”REG_DWORD”
set o_WScript=nothing
end sub
</script>
</head>

Ref  http://www.devguru.com/technologies/wsh/17418

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s