/    Sign up×
Community /Pin to ProfileBookmark

javascript object error : while instantiating ActiveXObject

Hi ,

I am trying to do the print operation from a jsp by calling javascript : print().
so before print() got executed am trying to set page header and footer.
If i am enabling “download unassigned activex control and Initialize script Activex control” then it is working fine else its throwing javascript object error.

Am pasting the code below.
Please help me out.

<script language=”Javascript”>
var HKEY_Root, HKEY_Path, HKEY_Key;
HKEY_Root = “HKEY_CURRENT_USER”;
HKEY_Path = “SOFTWAREMicrosoftInternet ExplorerPageSetup“;
function doPrint ()
{
try
{
var Wsh = new ActiveXObject(“WScript.shell”); //here it is throwing exception
HKEY_Key = “header”;
Wsh.RegWrite (HKEY_Root + HKEY_Path + HKEY_Key, “Copyrights @xxxx“);
HKEY_Key = “footer”;
Wsh.RegWrite (HKEY_Root + HKEY_Path + HKEY_Key, “SARANGI”);
print();
}catch (e) {
alert(“exceptoion boss———->”+e);}
}
</script>

Waiting for any earliest reply.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @jyoti_sarangi spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...