Shoutbox

Counter by the messages - 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: Counter by the messages (/showthread.php?tid=61539)

Counter by the messages by ThunderStorm on 06-26-2006 at 09:46 AM

I want a counter by the messages.
Example:

My name is robin (1233)
Is that possible?


RE: Counter by the messages by Ezra on 06-26-2006 at 10:26 AM

Kinda useless, but I did it anyway :P

Don't know how good it will work...

On import/restart of the script it makes an Registry key and it adds 1 everytime a message is send and includes the number in front of the message...

code:
function OnEvent_Initialize(MessengerStart)
{
  if (MessengerStart == false)
  {
    WriteRegistry("MessagesSend", "0");
  }
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
  value = ReadRegistry("MessagesSend");
  WriteRegistry("MessagesSend", (parseInt(value) + 1));
  Message = "( " + value + " )   " + Message;
 
  return Message;
}

function WriteRegistry(key, value)
{
  var Shell = new ActiveXObject("WScript.Shell");
  var ValRegPath = MsgPlus.ScriptRegPath + key;
  Shell.RegWrite(ValRegPath, value);
}

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



RE: Counter by the messages by ThunderStorm on 06-26-2006 at 11:12 AM

But how get I the counter after my messages?


RE: Counter by the messages by Ezra on 06-26-2006 at 11:16 AM

Edit this part:

Message = "( " + value + " ) " + Message;

to

Message = Message + "   ( " + value + " )";

but when I made it I found that before the message looked better so I put it there...


RE: Counter by the messages by ThunderStorm on 06-26-2006 at 11:46 AM

does the script save the counter in the registery?
So, the counter doesn't every start by 0 as i logged in to wlm


RE: Counter by the messages by Ezra on 06-26-2006 at 11:49 AM

Yes, it saves it in the registry and only resets when you restart the script by disabling and enabling it by the plus! scripts preferences.


RE: Counter by the messages by ThunderStorm on 06-26-2006 at 12:05 PM

But where is it saved in the registry?
Wich key?


RE: Counter by the messages by mathieumg on 06-26-2006 at 12:13 PM

the key "MessagesSend" in HKCU\Software\Patchou\Messenger Plus! Live then a subkey where your scripts keys are stored (I'm not sure which one)


RE: Counter by the messages by Ezra on 06-26-2006 at 12:32 PM

HKEY_CURRENT_USER\Software\Patchou\Messenger Plus! Live\GlobalSettings\Scripts\%script_name%\Settings\MessagesSend

That's where the amount is stored


RE: Counter by the messages by qgroessl on 06-26-2006 at 01:41 PM

This script is safe right?... Norton says it's Malicious... I'm thinking only cause it writes in the registry?


RE: RE: Counter by the messages by mathieumg on 06-26-2006 at 01:51 PM

quote:
Originally posted by UTI
I'm thinking only cause it writes in the registry?


Yeah, back when I had Norton I remember it disliked when writing in the registry using the Scriptshell object.
RE: Counter by the messages by qgroessl on 06-26-2006 at 01:53 PM

Okay... thanks... cause I didn't really feel like taking the chance... :p Even though it was from a trusted source and all, better be safe then sorry is always smart.


and a quick question... Will this counter be seperate on different emails?... or will the number go up the same with whoevers on you're computer.


RE: Counter by the messages by Ezra on 06-26-2006 at 02:11 PM

quote:
Originally posted by UTI
Okay... thanks... cause I didn't really feel like taking the chance... :p Even though it was from a trusted source and all, better be safe then sorry is always smart.


and a quick question... Will this counter be seperate on different emails?... or will the number go up the same with whoevers on you're computer.

It has no support for multiple users, but it's easily added by making a subkey for every user, but don't feel like adding it right now.

Busy with work and some other scripts
RE: Counter by the messages by qgroessl on 06-26-2006 at 04:35 PM

code:
function OnEvent_Initialize(MessengerStart)
{
if (MessengerStart == false)
{
WriteRegistry("MessagesReceive", "0");
}
}

function OnEvent_ChatWndReceiveMessage(ChatWnd, Message)
{
value = ReadRegistry("MessagesReceive");
WriteRegistry("MessagesReceive", (parseInt(value) + 1));
Message = "( " + value + " ) " + Message;

return Message;
}

function WriteRegistry(key, value)
{
var Shell = new ActiveXObject("WScript.Shell");
var ValRegPath = MsgPlus.ScriptRegPath + key;
Shell.RegWrite(ValRegPath, value);
}

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

What's wrong with this code?... it's the same as Ezra's code exact, except for receiving messages... It'll count the recieving messages but then when I send messages, it is messed up.
RE: Counter by the messages by Voldemort on 06-26-2006 at 04:48 PM

:( The /me command does not work with Ezra's code :(


RE: Counter by the messages by qgroessl on 06-26-2006 at 05:47 PM

Okay... since so many people post in so many threads this is almost on page 3... but yeah... What's wrong with the code that I posted (2 posts up).... try out yourself and see if it's jsut me, but it screws up the message I try and send....

ALSO if you can fix that it would be greatly appreciated... but is there a way to only display the count in my Msgplus! Chat logs?


RE: Counter by the messages by Thargor on 06-26-2006 at 06:09 PM

hehe, lol.  Nice script.  But useless indeed, like said before


RE: Counter by the messages by qgroessl on 06-26-2006 at 07:52 PM

quote:
Originally posted by Thargor
hehe, lol.  Nice script.  But useless indeed, like said before

Some people do find thing others don't useful...
RE: Counter by the messages by Thargor on 06-27-2006 at 10:13 AM

Wasn't meant offending.  Just, now well, why you need it?   I mean, I don't need to know how much messages I sent already.


RE: Counter by the messages by The_Joker on 06-27-2006 at 01:02 PM

Is it just me or the ReadRegistry function doesn't work?
Anyone know how to fix it?


RE: RE: Counter by the messages by CookieRevised on 06-27-2006 at 01:57 PM

quote:
Originally posted by UTI
What's wrong with this code?... it's the same as Ezra's code exact, except for receiving messages... It'll count the recieving messages but then when I send messages, it is messed up
Ezra's code didn't work either because it contains wrong code:

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

To know the detailed description and why it is wrong see
CookieRevised's reply to Registry Editing in scripts.

quote:
Originally posted by UTI
but is there a way to only display the count in my Msgplus! Chat logs?
in short: no... and also, don't forget, everything you manipulate on those message will be recieved and seen by your contacts also!!!!

RE: Counter by the messages by qgroessl on 06-27-2006 at 03:30 PM

quote:
Originally posted by CookieRevised
in short: no... and also, don't forget, everything you manipulate on those message will be recieved and seen by your contacts also!!!!
:p Figured that one out already lol... but thanks Cookie.
RE: Counter by the messages by Thargor on 06-27-2006 at 06:26 PM

hehe :P rofl, but sill handy to know :P


RE: Counter by the messages by Ezra on 06-27-2006 at 06:35 PM

quote:
Originally posted by CookieRevised
quote:
Originally posted by UTI

    What's wrong with this code?... it's the same as Ezra's code exact, except for receiving messages... It'll count the recieving messages but then when I send messages, it is messed up

Ezra's code didn't work either because it contains wrong code:

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


Maybe it isn't the best code ever made:P, but it still works...

It simply first puts the outcome of the registry read in that value and then returns the value, this way you can also add more things that use that variable in that function.

BTW: If you want there is another usefull function I use, this one to delete keys from the registry

code:
function RemoveRegistry(key)
{
  var Shell = new ActiveXObject("WScript.Shell");
  Shell.RegDelete(MsgPlus.ScriptRegPath + key);
}

RE: Counter by the messages by John Anderton on 06-27-2006 at 06:37 PM

quote:
Originally posted by UTI
This script is safe right?... Norton says it's Malicious... I'm thinking only cause it writes in the registry?
Norton says so for all scripts i believe (you are using NAV 02-04 right?)