I would like to know how to write and read records with messenger plus 5.
I was trying this:
code:
var Send=0;
var Received=0;
var _last_msg='';
var _last_name='';
var _song;
var SHELL=new ActiveXObject("WScript.shell");
var _PATH1=MsgPlus.ScriptFilesPath+"\\RECEIVED";
var _PATH2=MsgPlus.ScriptFilesPath+"\\SEND";
var _PATH3=MsgPlus.ScriptFilesPath+"\\NAME";
var _PATH4=MsgPlus.ScriptFilesPath+"\\MSG";
function Status()
{
ChatWnd.SendMessage("Status "+Messenger.MyName);
};
function Save()
{
SHELL.RegWrite(_PATH1,Received);
SHELL.RegWrite(_PATH2,Send);
SHELL.RegWrite(_PATH3,_last_name);
SHELL.RegWrite(_PATH4,_last_msg);
};
function Load()
{
Received=SHELL.RegRead(_PATH1);
Send=SHELL.RegRead(_PATH2);
_last_name=SHELL.RegRead(_PATH3);
_last_msg=SHELL.RegRead(_PATH4);
};
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MsgKind)
{
if (Origin!=Messenger.MyName)
{
Received++;
if (Message!="status")
{
_last_msg=Message;
_last_name=Origin;
}
Messenger.MyPersonalMessage=_last_name+" say:"+_last_msg;
}else
{
if (Message!="status")
{
Send++;
}
}
if (Message=="status")
{//\0Music\01\0Listening to {0} - {1} ({2})\0
_song=Messenger.MyCurrentMedia;
_song=_song.replace("0Listening to {0} - {1} ({2})","");
ChatWnd.SendMessage("Status "+Messenger.MyName+"\nMessagens enviadas: ["+Send+"]\nMensagens recebidas: ["+Received+"]\nMusica atual: ["+_song+"]\nUltima mensagem por: ["+_last_name+"]\n assunto: ["+_last_msg+"]");
};
if (Message=="save")
{
ChatWnd.SendMessage("Registros salvos com sucesso!");
Save();
}else
if (Message=="load")
{
ChatWnd.SendMessage("Registros carregados com sucesso!");
Load();
}
};
but the following error occurred in debug.
code:
Error: Invalid root in registry key "C: \ Program Files \ Yuna Software \ Messenger Plus! \ WLM-Scripts \ Status \ RECEIVED. (code: -2147024893)
File: Status.js. Line: 27.
another question is how to create the class equal to c + + in javascript?
How do I create arrays in messenger plus 5?