What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » writing text in registry?

writing text in registry?
Author: Message:
PedroGabriel
Junior Member
**


Posts: 22
– / – / Flag
Joined: Jun 2010
O.P. Huh?  writing text in registry?
I want to write words on the Reg/Registry
but i only can write numbers .-.

I don't know how to write words anyone can help me?


The following script will write 5 on the Reg named Reg1  when open Messenger
with this code I can't write words
anybody can help me?

Sry my bad english >.<

Javascript code:
var
  Reg1 = 5;
  Reg1Path = MsgPlus.ScriptRegPath + '\\Reg1';
  Shell = new ActiveXObject('WScript.Shell');
 
function Read(){
    Reg1 = Shell.RegRead(Reg1Path);
return Reg1;
}
 
function Write(){
    Shell.RegWrite(Reg1, Reg1);;
}
 
function OnEvent_Initialize(MessengerStart){
    Reg1Path = MsgPlus.ScriptRegPath + '\\Reg1';
    Write();
}

08-13-2010 09:16 PM
Profile E-Mail PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
RE: writing text in registry?
You're writing the number '5' to the path '5'?  You should pass 'RegPath1' as the second parameter.  Also, you could try passing REG_SZ'' as a third parameter.
08-13-2010 09:40 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: writing text in registry?
Here is a bunch of registry functions I wrote.

It would be used like this

Javascript code:
Registry_SetKeyValue(HKCU, MsgPlus.ScriptRegPath.substr(5), 'key', 'this is a test', REG_SZ);
Debug.Trace(Registry_GetKeyValue(HKCU, MsgPlus.ScriptRegPath.substr(5), 'key');


.zip File Attachment: registry.zip (2.66 KB)
This file has been downloaded 152 time(s).

This post was edited on 08-13-2010 at 09:44 PM by matty.
08-13-2010 09:41 PM
Profile E-Mail PM Find Quote Report
PedroGabriel
Junior Member
**


Posts: 22
– / – / Flag
Joined: Jun 2010
O.P. RE: RE: writing text in registry?
Matty,
thanks for your help but
Your code is very complex ... I do not understand well

with the
Javascript code:
Registry_SetKeyValue(HKCU, MsgPlus.ScriptRegPath.substr(5), 'key', 'this is a test', REG_SZ);
Debug.Trace(Registry_GetKeyValue(HKCU, MsgPlus.ScriptRegPath.substr(5), 'key');

return False
>.>

I only want write words in Reg
eg: this is a test

you code is really complex .-.


whiz,
thanks for your help too but
are you talking about here right?
Javascript code:
function Write(){
    Shell.RegWrite(Reg1, Reg1);;
}


the correctly code is
Javascript code:
function Write(){
    Shell.RegWrite(Reg1Path, Reg1);;
}


my mistake


this works:
Javascript code:
var
 
  varPath = MsgPlus.ScriptRegPath + '\\new1';
  Shell = new ActiveXObject('WScript.Shell');
 
function Read(){
    sa = Shell.RegRead(Reg1Path);
return sa;
}
 
function Write(){
    //Shell.RegWrite(varPath, ''+Origin+'asdsd');
}
 
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, rMessage, MsgKind){
    if (rMessage=='aaa'){
        Shell.RegWrite(varPath, ''+Origin+'asdsd');
    }
}


why i Can't use here
Javascript code:
function Write(){
    //Shell.RegWrite(varPath, ''+Origin+'asdsd');
}


This post was edited on 08-13-2010 at 11:05 PM by PedroGabriel.
08-13-2010 09:59 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: writing text in registry?
RegWrite

Read that.

If you had REG_SZ as a third parameter you will be able to write strings.

My code isn't complex when you only are using the functions and not looking at the actual code. You should have been able to put the file in your script folder.
08-14-2010 01:33 AM
Profile E-Mail PM Find Quote Report
PedroGabriel
Junior Member
**


Posts: 22
– / – / Flag
Joined: Jun 2010
O.P. RE: writing text in registry?
Thanks Matty after a long time your script works for me

Thank you very much

@matty can I ask only one simple thing? (I don't want make another topic only for this)
I've read the documentation but i can not understand how to use

show contact email
Eg:

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, rMessage, MsgKind){
    if (rMessage !==''){
        ChatWnd.SendMessage(Contact.Email+'\n'+rMessage);
}}

I can't find this on forums too =[

This post was edited on 08-14-2010 at 01:59 AM by PedroGabriel.
08-14-2010 01:43 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: writing text in registry?
quote:
Originally posted by PedroGabriel
Eg:

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, rMessage, MsgKind){
    if (rMessage !==''){
        ChatWnd.SendMessage(Contact.Email+'\n'+rMessage);
}}

I can't find this on forums too =[
Contact.Email is not passed as a part of this function.

You need to enumerate the ChatWnd.Contacts object.

Javascript code:
function OnEvent_ChatWndReceiveMessage(pChatWnd, sOrigin, sMessage, nKind) {
    for (var oContact = new Enumerator(pChatWnd.Contacts); !oContact.atEnd(); oContact.moveNext()) {
        Debug.Trace(oContact.item().Email);
    }
}

08-14-2010 02:09 AM
Profile E-Mail PM Find Quote Report
PedroGabriel
Junior Member
**


Posts: 22
– / – / Flag
Joined: Jun 2010
O.P. RE: writing text in registry?
Thank you matty =]

This post was edited on 08-14-2010 at 02:18 AM by PedroGabriel.
08-14-2010 02:17 AM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: writing text in registry?
quote:
Originally posted by PedroGabriel
why i Can't use here
Javascript code:
function Write(){
    //Shell.RegWrite(varPath, ''+Origin+'asdsd');
}


Origin is not defined in the scope of Write. You could make the value to write a parameter of the Write function so that you can pass in the value where you call the function.

Javascript code:
function Write( Value ){ // Value is received as first parameter
    Shell.RegWrite( varPath, Value ); // We can use it here
}
 
function OnEvent_ChatWndReceiveMessage( ChatWnd, Origin, rMessage, MsgKind ){
    if ( rMessage == 'aaa' ){
        Write( Origin+'asdsd' ); // Passing a string as first parameter
    }
}

I suggest you first learn some more about the JScript language before diving in Plus! scripting, have a look at this tutorial on MSDN.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
08-14-2010 08:34 AM
Profile E-Mail PM Web Find Quote Report
PedroGabriel
Junior Member
**


Posts: 22
– / – / Flag
Joined: Jun 2010
O.P. RE: writing text in registry?
ah, I had forgotten that function Write () was a function that I had done
08-14-2010 09:47 PM
Profile E-Mail PM Find Quote Report
« 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