What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Registry Editing in scripts.

Registry Editing in scripts.
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Registry Editing in scripts.
quote:
Originally posted by The_Joker
Tried to use this script but with a function to read & write.
Write works great, but reads gives an error.
If I try the Debug.Trace it works, but return doesn't.
(PS. Taken the script from another post, copied and it doesn't work).

code:
function ReadRegistry(key)
{
var Shell = new ActiveXObject("WScript.Shell");
return value = Shell.RegRead(MsgPlus.ScriptRegPath + key);
}

To analyze where the error is in such situations you should lookup what each object exactly will return in its documentation....

If you do that and you look up MsgPlus.ScriptRegPath in the scripting documentation (or you do simply a test with that object alone) you'll see that it returns a registry path.

Now you append the variable "key" to it, in other words you append a string to a path without anything else.... thus there is something missing in between... Think of it as a file and directory:

"C:\Program Files\MSN Messenger" would be the path and "msnmsgr.exe" the file, append the two and you'll get:
"C:\Program Files\MSN Messengermsnmsgr.exe" which is obviously something not correct as there is a "\" missing...


In other words:
    Shell.RegRead(MsgPlus.ScriptRegPath + "\\" + key);
note that you need to put a double "\" as it is otherwise interpreted as a literal escape code

So change that in your example and run it again....


The script will again not give the desired result. Why? Because you have other errors. The proper syntax for a "return" statement is:
    return <variable>;

and "value = Shell.RegRead(MsgPlus.ScriptRegPath + key)" is not a value but a statement on its own. So either you do:

    var value = Shell.RegRead(MsgPlus.ScriptRegPath + key);
    return value;

or simply:

    return Shell.RegRead(MsgPlus.ScriptRegPath + key);

This post was edited on 06-27-2006 at 02:09 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
06-27-2006 01:48 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Registry Editing in scripts. - by Terry_K on 06-26-2006 at 08:31 AM
RE: Registry Editing in scripts. - by Ezra on 06-26-2006 at 08:34 AM
RE: Registry Editing in scripts. - by Terry_K on 06-26-2006 at 08:36 AM
RE: RE: Registry Editing in scripts. - by mathieumg on 06-26-2006 at 11:48 AM
RE: Registry Editing in scripts. - by The_Joker on 06-27-2006 at 01:00 PM
RE: Registry Editing in scripts. - by CookieRevised on 06-27-2006 at 01:48 PM
RE: Registry Editing in scripts. - by The Brain on 06-27-2006 at 01:57 PM
RE: Registry Editing in scripts. - by CookieRevised on 06-27-2006 at 02:08 PM
RE: Registry Editing in scripts. - by The_Joker on 06-27-2006 at 02:32 PM
RE: Registry Editing in scripts. - by matty on 06-27-2006 at 02:49 PM
RE: Registry Editing in scripts. - by The_Joker on 06-27-2006 at 03:19 PM
RE: RE: Registry Editing in scripts. - by CookieRevised on 06-28-2006 at 01:15 AM
RE: Registry Editing in scripts. - by matty on 06-27-2006 at 03:25 PM
RE: RE: RE: Registry Editing in scripts. - by The_Joker on 06-28-2006 at 10:20 AM
RE: Registry Editing in scripts. - by Ezra on 06-28-2006 at 10:26 AM
RE: RE: Registry Editing in scripts. - by The_Joker on 06-28-2006 at 10:31 AM
RE: Registry Editing in scripts. - by Ezra on 06-28-2006 at 10:38 AM
RE: RE: Registry Editing in scripts. - by The_Joker on 06-28-2006 at 10:41 AM
RE: RE: RE: Registry Editing in scripts. - by CookieRevised on 06-29-2006 at 06:12 PM
RE: Registry Editing in scripts. - by matty on 06-28-2006 at 12:18 PM


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