What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » does a registry string exhist

does a registry string exhist
Author: Message:
L. Coyote
Senior Member
****

Avatar
Captain Obvious

Posts: 981
Reputation: 49
38 / Male / Flag
Joined: Aug 2004
Status: Away
RE: does a registry string exhist
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;
:dodgy:
code:
return tmp != "";

Oh, genious. :rolleyes:

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. :dodgy:

This post was edited on 06-29-2006 at 09:48 PM by L. Coyote.

Hack, hack, hack!
Finally became a Systems Analyst! :spam:

06-29-2006 07:18 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
does a registry string exhist - by JonnyT on 06-29-2006 at 07:11 PM
RE: does a registry string exhist - by L. Coyote on 06-29-2006 at 07:18 PM
RE: RE: does a registry string exhist - by CookieRevised on 06-29-2006 at 10:38 PM
RE: does a registry string exhist - by matty on 06-29-2006 at 07:31 PM
RE: does a registry string exhist - by RaceProUK on 06-29-2006 at 09:36 PM
RE: does a registry string exhist - by JonnyT on 06-29-2006 at 09:43 PM
RE: does a registry string exhist - by L. Coyote on 06-29-2006 at 10:57 PM
RE: does a registry string exhist - by RaceProUK on 06-30-2006 at 11:48 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On