Remove Notifications when changing PSM - 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: Remove Notifications when changing PSM (/showthread.php?tid=92511)
Remove Notifications when changing PSM by Johnny09 on 10-08-2009 at 03:19 PM
Hello guys,
I finished my work on BlinkText addon v1.1, it will be soon available.
The Script works really fine but theres one thing that disturbs me.
When im in conversation with a friend, and change my PSM, he gets the notice
"Johnny changed his PSM to" .. "Johnny removed his PSM".
I hope you get what I mean.
In addition to this our pisplay pictures start a bit to blink with the new WLM.
Ive seen in nudges tool script or in Typing Invisible that you can beware msn from sending those notifications. You have to do something in the registry i think, but im not sure.
I`d be really glad if you guys could help me.
After a while when i change my PSM 6times per minute my contacts i write with get disturbed and fucked up.
I`d be glad for any help I can get.
Yours
Ioannis 'Johnny' Karatassis
RE: Remove Notifications when changing PSM by m0nst3rkill3r on 10-08-2009 at 03:22 PM
To the 1st Question.
If you wrote the Script by yourself, you should know, what is todo.
Post us the Script please.
RE: Remove Notifications when changing PSM by Johnny09 on 10-08-2009 at 03:28 PM
I have written the script myself, the only thing i want to know is
how to remove notifications on changing my PSM so that other users dont get disturbed.
Heres my Script:
code: /**
BlinkText addon 1.1 by Johnny
This script lets your PSM blink.
Just enter your personal settings in settings window and blinking
can begin!
The script saves your current PSM so when you deactivate the script
your old PSM is restored.
Due to a limitation in MSN the standard blink duration is set to
6000ms (6secs).
If you set a lower value than 6000 some display problems may
occur.
This is my first script for MSN
Have fun with my little addon.
I am not responsible for any damages - use at your own risk.
Johnny - Sep. 29, 2009
Version 1.1
- Fixed a critical Bug
-- BlinkText was stopped/ crashed when you logged in to MSN
- Added multilanguage support
-- Currently available: deutsch, english
- Added PSM Editor
-- Thanks to Trevor Profitt for his format-functions
- On disactivating the script, your PSM gets restored properly
- Improved Source Code
- Fixed some smaller bugs
Johnny - Oct. 08, 2009
**/
var counter = 0;
var wndBlink = false;
var WScript = new ActiveXObject('WScript.Shell');
var winShell = new ActiveXObject("Shell.Application");
var enabled = true;
var txt;
var monitorTime = 6000;
var myEmail;
/**
XML Language Settings
**/
var languages = ["english", "deutsch"];
var language = languages [0];
var XMLPath = "XML/";
var path = XMLPath + language + "/";
// Little text definitions
var deutsch = ["Einstellungen", "Autor", "Bitte BlinkText angeben", "Blinkdauer muss eine Zahl sein (ab 500)", "Einige Fehler sind aufgetreten", "Einstellungen gespeichert"];
var english = ["Settings", "Author", "Please define BlinkText", "Blinkduration must be a number (from 500)", "Some errors occured", "Settings saved"];
var lang = english;
Debug.DebuggingWindowVisible = true;
Debug.Trace("Script Start");
function LoadBlinkSettings(Email) {
enabled = (WScript.RegRead(MsgPlus.ScriptRegPath + Email + '\\BlinkStatus') == "Ja");
txt = WScript.RegRead(MsgPlus.ScriptRegPath + Email + '\\BlinkText');
monitorTime = WScript.RegRead(MsgPlus.ScriptRegPath + Email + '\\BlinkTime');
var cont = false;
for (i = 0; i < languages.length; i++) {
if (WScript.RegRead(MsgPlus.ScriptRegPath + Email + '\\BlinkLanguage') == languages[i]) {
cont = true;
}
}
language = (cont ? WScript.RegRead(MsgPlus.ScriptRegPath + Email + '\\BlinkLanguage') : "english");
if (language == languages[0]) {
lang = english;
}
else if (language == languages[1]) {
lang = deutsch;
}
else {
lang = english;
}
path = (cont ? XMLPath + WScript.RegRead(MsgPlus.ScriptRegPath + Email + '\\BlinkLanguage') + "/" : XMLPath + languages[0] + "/");
}
function OnEvent_Initialize(MessengerStart)
{
try {
var installed;
try {
installed = ( (WScript.RegRead(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkStatus') == "Ja") || (WScript.RegRead(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkStatus') == "Nein") );
}
catch(exception) {
installed = false;
}
if (!installed) {
WScript.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkStatus', "Nein");
WScript.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkText', txt);
WScript.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkTime', monitorTime);
WScript.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkLastMessage', Messenger.MyPersonalMessage);
WScript.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkLanguage', (language == english ? language : english));
wndBlink = MsgPlus.CreateWnd(path + "Blink.xml", "BlinkSettings");
wndBlink.Button_SetCheckState('bEnabled', enabled);
wndBlink.setControlText("bMyText", "[c=#666666]This is [c=#FF9900]Blink Text Addon[/c] v1.1[/c] - [c=#FF9900]by Johnny[/c]");
wndBlink.setControlText("bPreview", "[c=#666666]This is [c=#FF9900]Blink Text Addon[/c] v1.1[/c] - [c=#FF9900]by Johnny[/c]");
wndBlink.setControlText("bSecs", monitorTime);
for (i = 0; i < languages.length; i++) {
wndBlink.Combo_AddItem("bLanguage",languages[i],i);
}
wndBlink.Combo_SetCurSel("bLanguage",0);
Debug.Trace("Registry Entries");
}
myEmail = Messenger.MyEmail;
MsgPlus.AddTimer ("my_monitor", monitorTime);
Debug.Trace("Timer added");
} catch (exception) {
Debug.Trace("Not logged in yet");
MsgPlus.AddTimer ("my_monitor", monitorTime);
}
}
function OnEvent_Uninitialize(MessengerExit)
{
MsgPlus.CancelTimer("my_monitor");
Messenger.MyPersonalMessage = WScript.RegRead(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkLastMessage');
Debug.Trace("Timer cancelled & PSM is "+ Messenger.MyPersonalMessage);
}
function OnEvent_Timer(TimerId){
try {
LoadBlinkSettings(Messenger.MyEmail);
if (TimerId == 'my_monitor' && enabled){
if (counter % 2 == 0) {
Messenger.MyPersonalMessage = txt;
}
else {
Messenger.MyPersonalMessage = '';
}
counter++;
Debug.Trace("Counter is "+ counter);
if (counter > 4) counter = 1;
MsgPlus.AddTimer ("my_monitor", monitorTime);
}
} catch (exception) {
Debug.Trace("Not logged in yet.. waiting for login");
MsgPlus.AddTimer ("my_monitor", monitorTime);
}
}
function OnGetScriptMenu(nLocation)
{
var Menu;
Menu = '<ScriptMenu>';
Menu += '<MenuEntry Id="BlinkSettings">'+lang[0]+'</MenuEntry>';
Menu += '<MenuEntry Id="BlinkAuthor">'+lang[1]+'</MenuEntry>';
Menu += '</ScriptMenu>';
return Menu;
}
function OnBlinkAutorEvent_CtrlClicked(PlusWnd, ControlId) {
if (ControlId == "bClose") {
PlusWnd.Close(1);
}
}
function languageToId () {
switch (getLanguage()) {
case "english" :
return 0;
break;
case "deutsch" :
return 1;
break;
default: return 0;
}
}
function getLanguage () {
return WScript.RegRead(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkLanguage');
}
function OnBlinkSettingsEvent_CtrlClicked(PlusWnd, ControlId) {
var Text = PlusWnd.GetControlText("bMyText").toString();
var Cur1 = PlusWnd.EditBox_GetCurSelStart("bMyText");
var Cur2 = PlusWnd.EditBox_GetCurSelEnd("bMyText");
switch (ControlId) {
case "bBold":
PlusWnd.SetControlText("bMyText", Format(Text, "Bold", Cur1, Cur2));
break;
case "bUnderline":
PlusWnd.SetControlText("bMyText", Format(Text, "Under", Cur1, Cur2));
break;
case "bStrike":
PlusWnd.SetControlText("bMyText", Format(Text, "Strike", Cur1, Cur2));
break;
case "bItalic":
PlusWnd.SetControlText("bMyText", Format(Text, "Italic", Cur1, Cur2));
break;
case "bColor":
// ChooseColor Addon
var CHOOSECOLOR = Interop.Allocate(36);
CHOOSECOLOR.WriteDWORD(0, 36); //DWORD lStructSize
CHOOSECOLOR.WriteDWORD(4, 0); //HWND hwndOwner
CHOOSECOLOR.WriteDWORD(8, 0); //HWND hInstance
CHOOSECOLOR.WriteDWORD(12, 0x000000FF); //COLORREF rgbResult (COLORREF = 0x00bbggrr)
var CustColors = Interop.Allocate(64); //Create an array of 16 COLORREFs for CustColors
CHOOSECOLOR.WriteDWORD(16, CustColors.DataPtr); //COLORREF *lpCustColors (pointer to our array)
CHOOSECOLOR.WriteDWORD(20, 3); //DWORD Flags (3 = 2 (CC_FULLOPEN) + 1 (CC_RGBINIT) )
CHOOSECOLOR.WriteDWORD(24, 0); //LPARAM lCustData
CHOOSECOLOR.WriteDWORD(28, 0); //LPCCHOOKPROC lpfnHook
CHOOSECOLOR.WriteDWORD(32, 0); //LPCTSTR lpTemplateName
//Open the dialog box
var result = Interop.Call('comdlg32.dll', 'ChooseColorA', CHOOSECOLOR);
//If the user pressed ok convert it to hex
if(result == 1)
{
//Get decimal values
var r = CHOOSECOLOR.ReadDWORD(12) & 0xFF;
var g = (CHOOSECOLOR.ReadDWORD(12) / 0x100) & 0xFF;
var b = (CHOOSECOLOR.ReadDWORD(12) / 0x10000) & 0xFF;
//Get hex values
var hexchars="0123456789ABCDEF";
var r = hexchars.charAt((r >> 4) & 0xf) + hexchars.charAt(r & 0xF);
var g = hexchars.charAt((g >> 4) & 0xf) + hexchars.charAt(g & 0xF);
var b = hexchars.charAt((b >> 4) & 0xf) + hexchars.charAt(b & 0xF);
}
// -> //
var Text = PlusWnd.GetControlText("bMyText").toString();
//Get the cursor position(s)
var Cur1 = PlusWnd.EditBox_GetCurSelStart("bMyText");
var Cur2 = PlusWnd.EditBox_GetCurSelEnd("bMyText");
var Colorer = "#" + r + g + b;
PlusWnd.SetControlText("bMyText", Colors(Text, Colorer, Cur1, Cur2, null));
// -->
break;
case "bClose":
PlusWnd.Close(1);
break;
case "bSave":
var error = "";
if (PlusWnd.GetControlText("bMyText") == "") {
error += "\n- "+lang[2];
}
if (PlusWnd.GetControlText("bSecs") == "" || !IstNummer(PlusWnd.GetControlText("bSecs")) || PlusWnd.GetControlText("bSecs") < 500 ) {
error += "\n- "+lang[3];
}
if (error != "") {
error = lang[4] +":\n "+ error;
Interop.Call('user32', 'MessageBoxW', PlusWnd.Handle, error, "BlinkText Fehler", 64);
break;
}
if (enabled && !PlusWnd.Button_IsChecked("bEnabled")) {
Messenger.MyPersonalMessage = WScript.RegRead(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkLastMessage');
}
else if (!enabled && PlusWnd.Button_IsChecked("bEnabled")) {
WScript.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkLastMessage', Messenger.MyPersonalMessage);
}
WScript.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkStatus', (PlusWnd.Button_IsChecked("bEnabled")?"Ja":"Nein"));
WScript.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkText', PlusWnd.GetControlText("bMyText"));
WScript.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkTime', PlusWnd.GetControlText("bSecs"));
WScript.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\BlinkLanguage', PlusWnd.GetControlText("bLanguage"));
LoadBlinkSettings(Messenger.MyEmail);
MsgPlus.DisplayToast("BlinkText", lang[5]);
MsgPlus.AddTimer ("my_monitor", monitorTime);
PlusWnd.Close(1);
break;
}
}
function OnEvent_MenuClicked(sMenuId, nLocation, iOriginWnd)
{
LoadBlinkSettings(Messenger.myEmail);
if (sMenuId == "BlinkSettings")
{
wndBlink = MsgPlus.CreateWnd(path + "Blink.xml", "BlinkSettings");
wndBlink.Button_SetCheckState('bEnabled', enabled);
wndBlink.setControlText("bMyText", txt);
wndBlink.setControlText("bSecs", monitorTime);
if (txt == "") {
wndBlink.setControlText("bMyText", "[c=#666666]This is [c=#FF9900]Blink Text Addon[/c] v1.1[/c] - [c=#FF9900]by Johnny[/c]");
wndBlink.setControlText("bPreview", "[c=#666666]This is [c=#FF9900]Blink Text Addon[/c] v1.1[/c] - [c=#FF9900]by Johnny[/c]");
}
else {
wndBlink.setControlText("bPreview", txt);
}
for (i = 0; i < languages.length; i++) {
wndBlink.Combo_AddItem("bLanguage",languages[i],i);
}
wndBlink.Combo_SetCurSel("bLanguage",languageToId());
}
else if(sMenuId == "BlinkAuthor")
{
var wndAbout = MsgPlus.CreateWnd(path + "Author.xml", "BlinkAutor");
}
}
function OnBlinkSettingsEvent_EditTextChanged(PlusWnd, ControlId) {
if (ControlId == "bMyText") {
PlusWnd.setControlText ("bPreview", PlusWnd.getControlText("bMyText"));
}
}
function IstNummer (myText) {
var zeichen = "0123456789";
var weiter = true;
for (i = 0; i < zeichen.length && weiter; i++)
{
if (zeichen.indexOf(myText.charAt) == -1) {
weiter = false;
}
}
return weiter;
}
//////////////////////////////
// Functions by Trevor Profitt
//
//////////////////////////////
function Format(String, Type, Cur1, Cur2) {
//define the types of formatting (other than color and gradient color).
var Types = new Array();
Types["Bold"] = "b";
Types["Italic"] = "i";
Types["Under"] = "u";
Types["Strike"] = "s";
SendBackString = String.toString();
//If something is selected
if (Cur1.toString().search(/\u005E/) == -1) {
//If only one character is selected
if (Cur1 == Cur2) {
//Insert the format tags
return String.substring(0, Cur1) + "[" + Types[Type] + "][/" + Types[Type] + "]" + String.substring(Cur2);
}
//If multiple characters are selected
else {
//Insert the format tags
return String.substring(0, Cur1) + "[" + Types[Type] + "]" + String.substring(Cur1, Cur2) + "[/" + Types[Type] + "]" + String.substring(Cur2);
}
}
//If nothing is selected, add the format tags at the beginning of the string
else if (Cur1.toString().search(/\u005E/) != -1) {
return "[" + Types[Type] + "][/" + Types[Type] + "]" + String;
}
//If an error occurs
else {
}
}
function Colors(String, Name, Cur1, Cur2, Grad) {
//Make sure something is selected
if (Cur1.toString().search(/^\d+$/) != -1 && Cur2 >= Cur1) {
//Make sure the first color is valid
if (Name.toString().search(/^\u0023\w{6}$/) != -1) {
//If only one place is selected
if (Cur1 == Cur2) {
//If isn't Gradient
if (Grad == null) {
//Format the String
return String.substring(0, Cur1) + "[c=" + Name + "][/c]" + String.substring(Cur1);
}
//If Gradient
else {
//Make sure the second color is valid
if (Grad.toString().search(/^\u0023\w{6}$/) != -1) {
//Make sure the two colors aren't the same.
if (Grad.toString() != Name.toString()) {
//Format the String
return String.substring(0, Cur1) + "[c=" + Name + "][/c=" + Grad + "]" + String.substring(Cur2);
}
//If they are different
else {
//Show an Alert telling the user the script changed the format.
//showError("", "The two colors were the same so\nthe script made them one\ncode.");
//Return and Format the String
return String.substring(0, Cur1) + "[c=" + Name + "][/c]" + String.substring(Cur1);
}
}
//If the second Color is invalid
else {
//Show an error saying the color is invalid
//showError("", "The Second color is invalid.");
//Return the original string, unformatted
return String;
}
}
}
//If multiple characters are selected
else {
//If color isn't gradient
if (Grad == null) {
//Return and Format the String
return String.substring(0, Cur1) + "[c=" + Name + "]" + String.substring(Cur1, Cur2) + "[/c]" + String.substring(Cur2);
}
//If color is gradient
else {
//If second color is valid
if (Grad.toString().search(/^\u0023\w{6}$/) != -1) {
//IF the two colors aren't the same
if (Grad.toString() != Name.toString()) {
//Return and Format the String
return String.substring(0, Cur1) + "[c=" + Name + "]" + String.substring(Cur1, Cur2) + "[/c=" + Grad + "]" + String.substring(Cur2);
}
//If they are the same...
else {
//Show an Alert telling the user the script changed the format.
//showError("", "The two colors were the same so\nthe script made them one\ncode.");
//Return and Format the String
return String.substring(0, Cur1) + "[c=" + Name + "]" + String.substring(Cur1, Cur2) + "[/c]" + String.substring(Cur2);
}
}
else {
//Show an error saying the color is invalid
//showError("", "The Second color is invalid.");
return String;
}
}
}
}
//If the first color is invalid
else {
//Show an error saying the color is invalid
//showError("", "The First color is invalid.");
//Return the original String.
return String;
}
}
//If nothing is selected
else {
//Make sure the color is valid
if (Name.toString().search(/^\u0023\w{6}$/) != -1) {
//If color isn't gradient
if (Grad == null) {
//Return and format the string.
return "[c=" + Name + "][/c]" + String;
}
//If color is Gradient
else {
//Make sure the second color is valid
if (Grad.toString().search(/^\u0023\w{6}$/) != -1) {
//Make sure the two color arent the same
if (Grad.toString() != Name.toString()) {
//return and format the string
return "[c=" + Name + "][/c=" + Grad + "]" + String;
}
//If they are the same
else {
//Alert the user that the script changed the color format
//showError("", "The two colors were the same so\nthe script made them one\ncode.");
//Return and format the string
return "[c=" + Name + "][/c]" + String;
}
}
//If the second color was invalid
else {
//Show an error
//showError("", "The Second color is invalid.");
//return the original string
return String;
}
}
}
//If the first color was invalid
else {
//Show an error
//showError("", "The First color is invalid.");
//return the original string
return String;
}
}
}
// -->
I attached my whole script.
RE: Remove Notifications when changing PSM by matty on 10-08-2009 at 03:34 PM
quote: Originally posted by m0nst3rkill3r
To the 1st Question.
If you wrote the Script by yourself, you should know, what is todo.
That isn't a fair statement because beginning scripters may not have the programming background to determine the best route to fix this.
I am abit confused as to where this text is being displayed. Are you using the ChatWnd:isplayInfoMessage function to display this text? If so you will need to check the new psm.
RE: Remove Notifications when changing PSM by Johnny09 on 10-08-2009 at 03:48 PM
This is my first Script in JScript for MSN.. so sorry if im not really experienced in it. Im a web programmer (PHP, JAVA, XML, XSLT..) and i wanted to make a little addon for MSN.
My BlinkText addon is a little fun application.
You enter your blinktext in a settings menu and activate the script.
And soon your PSM starts to blink, its this part here:
code: if (TimerId == 'my_monitor' && enabled){
if (counter % 2 == 0) {
Messenger.MyPersonalMessage = txt;
}
else {
Messenger.MyPersonalMessage = '';
}
...
a timer counts up a variable and so i get my blink effect.
due to a limitation in msn i can change my PSM only 6times per minute.
each time i change my PSM my contact partner can see in our window:
"Johnny changed his personal message to ..."
in german it would be
"Johnny änderte seine status nachricht in ..."
"Johnny entferne seine status nachricht"..
I attached i picture so you can see which notification i mean
RE: Remove Notifications when changing PSM by matty on 10-08-2009 at 04:56 PM
Yeah unfortunately that cannot be helped.
RE: Remove Notifications when changing PSM by Johnny09 on 10-08-2009 at 05:03 PM
So there is no way??
Typing invisible removed the noticationen "Johnny is typing a message" so i thought it would be also possible to remove notification when changing PSM
RE: Remove Notifications when changing PSM by matty on 10-08-2009 at 05:48 PM
That is something that is sent over the protocol that is why it can be disabled. The notification of a PSM changing is something the App detects when the Protocol sends an update saying it has been changed.
RE: Remove Notifications when changing PSM by Johnny09 on 10-08-2009 at 07:17 PM
Yes, i understand.. its sad that theres nothing to do to avoid that problem. Maybe you have another idea matty what i can do?
Something similar?
RE: Remove Notifications when changing PSM by Spunky on 10-08-2009 at 08:02 PM
@matty: Does ChatWnd.ResetInfoMessage only work for messages you've put there via ChatWnd.DisplayInfoMessage?
RE: Remove Notifications when changing PSM by matty on 10-08-2009 at 08:13 PM
The ChatWnd::ResetInfoMessage could potentially work. I did think of this however there is a limitation. The limitation is that everyone you chat with needs to have your script to prevent the text from being displayed.
Also you would need to do something like this:
js code: function OnEvent_ContactPsmChange ( sEmail , sPsm ) {
for ( var oChatWnd = new Enumerator ( Messenger.CurrentChats ); !oChatWnd.atEnd(); oChatWnd.moveNext() ) {
if ( oChatWnd.item().Contacts.GetContact ( sEmail ) !== null ) {
oChatWnd.item().ResetInfoMessage();
}
}
}
That would reset the info message for every chat window that the contact is in (in case of group chats).
RE: Remove Notifications when changing PSM by Spongshga on 11-28-2009 at 01:16 PM
@Johnny09 i have a great new idea to ad another stuff to your Script:
check it out... http://shoutbox.menthix.net/showthread.php?tid=93...d=980682#pid980682
|