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

Pages: (2): « First [ 1 ] 2 » Last »
Registry Editing in scripts.
Author: Message:
Terry_K
Junior Member
**


Posts: 38
– / Male / –
Joined: May 2006
O.P. Registry Editing in scripts.
Would anyone know how to edit the registry using a Messenger Plus! Live script? I can do it with Visual Basic .NET but it would help if someone told me how to write it in a script.

Thanks in advance.
Terry K
06-26-2006 08:31 AM
Profile PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: Registry Editing in scripts.
quote:
Originally posted by Scripting Manual

//Write the value
var Shell = new ActiveXObject("WScript.Shell");
var ValRegPath = MsgPlus.ScriptRegPath + "EnableOpt";
Shell.RegWrite(ValRegPath, 1);

//Read the value
var EnableOpt = Shell.RegRead(ValRegPath);
Debug.Trace("EnableOpt current value: " + EnableOpt);


I would read that Manual If I were you, lots of examples in it.
[Image: 1-0.png]
             
06-26-2006 08:34 AM
Profile PM Web Find Quote Report
Terry_K
Junior Member
**


Posts: 38
– / Male / –
Joined: May 2006
O.P. RE: Registry Editing in scripts.
Thank you.

If by manual you mean scripting documentation, i'll do that.
Terry K
06-26-2006 08:36 AM
Profile PM Web Find Quote Report
mathieumg
Full Member
***


Posts: 181
Reputation: 2
34 / Male / Flag
Joined: May 2004
RE: RE: Registry Editing in scripts.
quote:
Originally posted by Terry_K
If by manual you mean scripting documentation


That's what he meant ;)
Official MessengerPlus! Live French Translator
Official StuffPlug 3 French Translator

:)
06-26-2006 11:48 AM
Profile E-Mail PM Web Find Quote Report
The_Joker
Full Member
***

Avatar
TF

Posts: 125
Joined: Oct 2005
RE: Registry Editing in scripts.
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);
}
Messenger Plus! 3.61 unofficial Hebrew translator
Messenger Plus! Live unofficial Hebrew translator
06-27-2006 01:00 PM
Profile PM Find Quote Report
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
The Brain
Junior Member
**

Avatar

Posts: 49
Reputation: 1
– / Male / Flag
Joined: Jan 2003
RE: Registry Editing in scripts.
quote:
From the Scripting Documentation
A string containing the path to the script's registry key. The path begins with "HKCU\" to designate the HKEY_CURRENT_USER key and ends with a backslash.

Sorry Cookie, but Plus gives you a Registry path ending with a backslash. If fixing the return statement doesn't fix it, I would imagine the error is because the variable key is not valid. Registry keys are case sensitive as awell, aren't they? Open regedit (via Start > Run) and check that the key you are looking for is actually there.

The Scripts Registry path is:
"HKEY_CURRENT_USER\Software\Patchou\Messenger Plus! Live\GlobalSettings\Scripts\"
Followed by the name of the script.

This post was edited on 06-27-2006 at 02:01 PM by The Brain.
06-27-2006 01:57 PM
Profile PM Web Find Quote Report
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 Brain
Sorry Cookie, but Plus gives you a Registry path ending with a backslash.
yeah, I noticed and was editing my post while you posted... Thanks for notifying though (y)

quote:
Originally posted by The Brain
Registry keys are case sensitive as awell, aren't they?
Nope, they are case insensitive...

PS: note that the ActiveX registry object methods are rather limited though... to do more registry manipulation (or even writing binary data etc) you need to use the Windows APIs.

This post was edited on 06-27-2006 at 02:32 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
06-27-2006 02:08 PM
Profile PM Find Quote Report
The_Joker
Full Member
***

Avatar
TF

Posts: 125
Joined: Oct 2005
RE: Registry Editing in scripts.
yeah, thought about the "return value = ..." thing...
I tried to play with it for over a hour and didn't succeed.
It works perfectly with Debug.Trace, so the problem is that it refuses to return the value.
Do I need to set the type of the return value or something?

BTW, tried to put it in value and "return value", tried just "return  Shell.Reg...", nothing works.

hmm, didn't tried to put it as a code in the orginal function and not in a separate function, but I use it too many times so it will be annoying and won't look nice...

[offtopic]
Can't check it now, back to good old 7.5 :P
Is it just me or WML doesn't seems so user-friendly (visually) like MSNM?
[/offtopic]
Messenger Plus! 3.61 unofficial Hebrew translator
Messenger Plus! Live unofficial Hebrew translator
06-27-2006 02:32 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Registry Editing in scripts.
This is what I use for Screenshot Sender 4. If  you choose to keep the script you must keep the header regardless if you change the file or not.

This script is going to be apart of the snippets that will be available on http://mpscripts.net

For now its hosted on my server.

http://mattyg.ca/geshi/registry.php

Geshi : Generic Syntax Highlighter
http://qbnz.com/highlighter/


Note : If there are any errors with it please PM me. As well I am going to be changing the functions around a bit so I will update the file on my server and the latest one will be on http://mpscripts.net when we get enough snippets made.

This post was edited on 06-27-2006 at 02:51 PM by matty.
06-27-2006 02:49 PM
Profile E-Mail PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


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