Computing.Net > Forums > Programming > javascripting problem\question ?

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

javascripting problem\question ?

Reply to Message Icon

Original Message
Name: brav0
Date: January 12, 2004 at 04:02:10 Pacific
Subject: javascripting problem\question ?
OS: NT
CPU/Ram: p4 | 512mb
Comment:

Okay here's the problem ,

when a user browses to a web page , i can get it so a prompt asks them for their net bios name .. when they click ok the information is displayed back to them using the document.write function .....

however instead of displaying the function on the screen ... is it possible to write the function on the page but inserting it into another script ???

ie

can it be writted to this :

var shell=new ActiveXObject("WScript.shell");
Shell.Run("cmd /k reg update 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\control\session manager\memory management\paging files'='C:\pagefile.sys 256 256' \\<net bios name>', 0);

the net bios name being the inputted data from the user ...

casn it be done ... if so how ??

thanks in advance


Report Offensive Message For Removal


Response Number 1
Name: brav0
Date: January 12, 2004 at 07:07:32 Pacific
Reply: (edit)

okay this is a page i've got that will adjust the virtual memory setting of a machine over the corporate network ..


<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">

<HTML>
<HEAD>
<TITLE> Baguley </TITLE>

</HEAD>
<BODY >

<SCRIPT LANGUAGE="JavaScript" type="text/javascript">

</SCRIPT>

<CENTER>
<H1>Drive Mapped Successfully !</H1>
</CENTER>


<CENTER>
<FORM>
<INPUT type="button" value="Close Window" onClick="window.close()">
</FORM>
</CENTER>


</BODY>

</HTML>

now obviously the net bios name will be different for each machine ... so i'd need to create a form that will change the "netbios name" after user input....

any idea's how i can do this ??

I thought that this might do it .. however i keep getting syntax errors ..:P

<HTML>
<HEAD>


<SCRIPT type="text/javascript" LANGUAGE="JavaScript">
function executeCommands(inputparms)
{
// Instantiate the Shell object and invoke
its execute method.

var oShell = new ActiveXObject("WScript.Shell");

var commandtoRun=('cmd /k reg update "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management\\pagingfiles"="C:\\pagefiles.sys 784 784" \', 0);
if (inputparms != "")
{
var commandParms = document.Form1.filename.value;
}

// Invoke the execute method.
oShell.ShellExecute(commandtoRun, commandParms,
"", "open", "1");
}
</SCRIPT>


</HEAD>
<BODY>
<FORM name="Form1">
<CENTER>



<H1>Execute PC Commands From HTML </H1>



<File Name to Open:> <Input type="text"
name="filename"/>



<input type="Button" name="Button1"
value="Adjust Virtual Memory on Local Machine" onClick="executeCommands()" />




<input type="Button" name="Button2"
value="Adjust Virtual Memory on a Remote Machine"
onClick="executeCommands(' + hasPARMS + ')" />

</CENTER>
</BODY>
</FORM>


help me please .. :P


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you own an iPhone?

Yes
No, but soon
No


View Results

Poll Finishes In 6 Days.
Discuss in The Lounge
Poll History




Data Recovery Software