Jump to content

HELP! .reg to Javascript.


Recommended Posts

OKAY here is the reg key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"WPI"=-

NOTE This is DELETING the sub-key of WPI.

Now the issue is I can get it to delete the whole run section (Not very good) But not just the sub-key.

I have the function DeleteRunEntry built in that will call this function I just need the javascript to delete a sub-key.

ANY IDEAS?

Link to comment
Share on other sites


hi kelsenellenelvian

i think that this is the answer to your post (i hope)

Deleting Registry Keys and Values

To delete a registry key with a .reg file, put a hyphen (-) in front of the RegistryPath in the .reg file. For example, to delete the Test subkey from the following registry key:

HKEY_LOCAL_MACHINE\Software

put a hyphen in front of the following registry key in the .reg file:

HKEY_LOCAL_MACHINE\Software\Test

The following example has a .reg file that can perform this task.

[-HKEY_LOCAL_MACHINE\Software\Test]

To delete a registry value with a .reg file, put a hyphen (-) after the equals sign following the DataItemName in the .reg file. For example, to delete the TestValue registry value from the following registry key:

HKEY_LOCAL_MACHINE\Software\Test

put a hyphen after the "TestValue"= in the .reg file. The following example has a .reg file that can perform this task.

HKEY_LOCAL_MACHINE\Software\Test

"TestValue"=-

To create the .reg file, use Regedit.exe to export the registry key that you want to delete, and then use Notepad to edit the .reg file and insert the hyphen.

the full link is

http://support.microsoft.com/kb/310516/en-us

:hello: newbie1

Link to comment
Share on other sites

OKAY here is the reg key:

var WshShell = WScript.CreateObject("WScript.Shell");
gVal = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\WPI";
try{
WshShell.RegDelete(gVal);
}
catch(e){
var sTest = e.description.substr(0,7);
if(sTest=="Unable "){
WshShell.Popup("value does not exist");
}
else {
if(sTest=="Invalid"){
WshShell.Popup("key does not exist");
}
else {
WshShell.Popup(e.description);
}
}
}

Link to comment
Share on other sites

OKAY Here is the idea I have (Let me try to clarify it better.)

In the options installer tab I added a function called "Deleterunentry" I added this entry because I want users to be able to have WPI load AFTER the desktop has loaded BUT to do this i need to add WPI to the run list like a regular prog. However I don't think we really need to make WPI load everytime a user reboots *silly*. Now the problem is I need the installer.hta to delete the entry on the beggining of the installation process but only if the user has selected this option in the options menu.

SO it needs to be: (In installer.hta like so)

<script type="text/javascript">
if (ResumeInstall)

That deletes the key exactly as this regentry:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"WPI"=-

I have tried all I can think of and I am prolly just bein stupid.

Link to comment
Share on other sites

Kel,

I'm hoping you are looking for something like this in java script:

function Deleterunentry()
{
position="api.js";
whatfunc="Deleterunentry()";

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

try
{
wsh.RegDelete("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\WPI");
}
catch (ex)
{; }
}

Oops, Sorry about that Yzöwl, didn't look through the dropdown .js section of your code well enough...that was where I was going. Kel, did Yzöwl's code not help?

Edited by lawrenca
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...