Shoutbox

writing text in registry? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: writing text in registry? (/showthread.php?tid=95244)

writing text in registry? by PedroGabriel on 08-13-2010 at 09:16 PM

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();
}

RE: writing text in registry? by whiz on 08-13-2010 at 09:40 PM

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.


RE: writing text in registry? by matty on 08-13-2010 at 09:41 PM

Here is a bunch of registry functions I wrote.

It would be used like this

js 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');

RE: RE: writing text in registry? by PedroGabriel on 08-13-2010 at 09:59 PM

Matty,
thanks for your help but
Your code is very complex ... I do not understand well

with the

js 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?
js code:
function Write(){
    Shell.RegWrite(Reg1, Reg1);;
}

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

my mistake


this works:
js 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
js code:
function Write(){
    //Shell.RegWrite(varPath, ''+Origin+'asdsd');
}

RE: writing text in registry? by matty on 08-14-2010 at 01:33 AM

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.


RE: writing text in registry? by PedroGabriel on 08-14-2010 at 01:43 AM

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 =[


RE: writing text in registry? by matty on 08-14-2010 at 02:09 AM

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.

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

RE: writing text in registry? by PedroGabriel on 08-14-2010 at 02:17 AM

Thank you matty =]


RE: writing text in registry? by Matti on 08-14-2010 at 08:34 AM

quote:
Originally posted by PedroGabriel
why i Can't use here
js 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.

js 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.
RE: writing text in registry? by PedroGabriel on 08-14-2010 at 09:47 PM

ah, I had forgotten that function Write () was a function that I had done