Remove Notifications when changing PSM |
Author: |
Message: |
Johnny09
New Member
Posts: 13
Joined: Sep 2008
|
O.P. Remove Notifications when changing PSM
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
|
|
10-08-2009 03:19 PM |
|
|
m0nst3rkill3r
Junior Member
Posts: 51
Joined: Sep 2009
|
RE: Remove Notifications when changing PSM
To the 1st Question.
If you wrote the Script by yourself, you should know, what is todo.
Post us the Script please.
|
|
10-08-2009 03:22 PM |
|
|
Johnny09
New Member
Posts: 13
Joined: Sep 2008
|
O.P. RE: Remove Notifications when changing PSM
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.
Attachment: BlinkText-Addon-1.1.plsc (21.2 KB)
This file has been downloaded 122 time(s).
|
|
10-08-2009 03:28 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: Remove Notifications when changing PSM
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.
|
|
10-08-2009 03:34 PM |
|
|
Johnny09
New Member
Posts: 13
Joined: Sep 2008
|
O.P. RE: Remove Notifications when changing PSM
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
Attachment: notification.jpg (39.73 KB)
This file has been downloaded 119 time(s).
|
|
10-08-2009 03:48 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: Remove Notifications when changing PSM
Yeah unfortunately that cannot be helped.
|
|
10-08-2009 04:56 PM |
|
|
Johnny09
New Member
Posts: 13
Joined: Sep 2008
|
O.P. RE: Remove Notifications when changing PSM
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
|
|
10-08-2009 05:03 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: Remove Notifications when changing PSM
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.
|
|
10-08-2009 05:48 PM |
|
|
Johnny09
New Member
Posts: 13
Joined: Sep 2008
|
O.P. RE: Remove Notifications when changing PSM
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?
|
|
10-08-2009 07:17 PM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
RE: Remove Notifications when changing PSM
@matty: Does ChatWnd.ResetInfoMessage only work for messages you've put there via ChatWnd.DisplayInfoMessage?
<Eljay> "Problems encountered: shit blew up"
|
|
10-08-2009 08:02 PM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|
|