I use this to check if a key exists.
It returns true if it does, and false if it doesn't exist.
Btw, it doesn't check for a value, just a key. But you can modify it. Instead of "return true", make it "return tmp" and check the returned value with whatever you want.
code:
function isreg(path) {
var reg, tmp;
try {
reg = new ActiveXObject("WScript.Shell");
tmp = reg.RegRead(RegUserPath + path);
if(tmp != "") return true;
} catch(e) {
return false;
}
}
This is just a workaround, not a real solution, but it works and prevents the script from returning an error.
You can read more of try...catch...finally in the MSDN library.
quote:
Originally posted by RaceProUK
quote:
Originally posted by Leonardo
if(tmp != "") return true;
code:
return tmp != "";
Oh, genious.
Seriously people, is there a difference? Except from saving 0.00001 second and a couple of bytes, is there really a difference? No? Then, let it go.