Toast popup - 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: Toast popup (/showthread.php?tid=93013)
Toast popup by SourSpud on 11-25-2009 at 05:31 AM
Is there a way to hide the toast when you receive the first message from someone, like this.
* tim opens convo *
Tim Says: hey!
* toast on my screen *
Tim Says: Hey!
is there a script that can stop that from appearing?
RE: Toast popup by warmth on 11-25-2009 at 05:35 AM
you can disable that in the settings of WLM by unchecking alert you when someone writes you my friend...
RE: Toast popup by SourSpud on 11-25-2009 at 05:55 AM
thanks but i would also like to do this as a script. I found this http://www.msgpluslive.cl/scripts/view/224-MSN-Popup-Spy/ but id like to make it so i don't see anything at all.
RE: Toast popup by Spunky on 11-25-2009 at 09:37 AM
Why? If there is already an option for it...
RE: Toast popup by SourSpud on 11-25-2009 at 09:43 AM
because I am learning, i would like to know its doable, as far as i know it only works if you have that popup showing. If anyone can do it id appreciate it.
Kind Regards,
SourSpud
RE: Toast popup by Spunky on 11-25-2009 at 10:27 AM
Edit the script you downloaded. You should be able to see how they did it and might be able to piece it together.
RE: Toast popup by SourSpud on 11-25-2009 at 10:40 AM
Tried that mate, this is my result.
jscript code: // MSN Popup Spy by .felipE
// http://felipex.net
// Mexico, Sinaloa, Los Mochis
var PlusWnd;
var show = true;
function OnuiEvent_CtrlClicked(Wnd, ControlId){
switch (ControlId){
case "cancel":
Interop.Call("User32", "AnimateWindow", Wnd.Handle, 180, 0x10000 | 0x80000);
Wnd.Close(1);
break;
case "save":
WriteRegistry("opacity",Wnd.GetControlText("wp"));
WriteRegistry("showlist", ( Boolean(Wnd.Button_IsChecked("chk")) == true ? "True" : "False") );
if ( Boolean(Wnd.Button_IsChecked("chk")) == true ){
var Box = Interop.Call("user32","FindWindowW","#32770","Msn Popup Spy Box");
if (Box) Interop.Call("user32","PostMessageA",Box,16,0,0); PlusWnd = null;
}
Interop.Call("User32", "AnimateWindow", Wnd.Handle, 180, 0x10000 | 0x80000);
Wnd.Close(1);
break;
}
}
function OnuiEvent_EditTextChanged(PlusWnd, ControlId){
if ( PlusWnd.GetControlText("wp") < 0 || PlusWnd.GetControlText("wp") > 255) PlusWnd.SetControlText("wp","0");
}
function OnEvent_MenuClicked(MenuItemId,Location,OriginWnd){
switch (MenuItemId)
{
case "MnuConf":
{
PlusWnd = MsgPlus.CreateWnd("window.xml","ui");
PlusWnd.SetControlText("wp", ReadRegistry("opacity") );
PlusWnd.Button_SetCheckState("chk", ReadRegistry("showlist") );
break;
}
case "MnuAbout":
{
var Handle = (Location == 2 ? OriginWnd.Handle : Messenger.ContactListWndHandle);
Interop.Call("user32","MessageBoxW",Handle,"Created by\n .felipE\n\n\nhttp://felipex.net\nhttp://messengeradictos.com","About MSN Popup Spy",64+4096);
//Interop.Call("shell32","ShellAboutW",Handle,"MSN Popup Spy","Created by .felipE\thttp://felipex.net",Handle);
break;
}
}
}
function OnEvent_Initialize(MessengerStart){
PlusWnd = MsgPlus.CreateWnd("window.xml","msnbox",1);
PlusWnd.visible=false;
if(Messenger.MyStatus > 0){
OnEvent_SigninReady(Messenger.MyEmail);
}
}
function OnEvent_SigninReady(Email){
try {
var firstrun = new ActiveXObject("WScript.Shell").RegRead(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\showlist");
}
catch(e) {
WriteRegistry("opacity","200");
WriteRegistry("showlist","False");
}
finally {
show = true;
MsgPlus.AddTimer("msnpopupspy",100);
}
}
function OnmsnboxEvent_Destroyed(PlusWndd,ExitCode){
show = true;
PlusWnd = null;
}
function OnEvent_Timer(TimerId){
var lngNotify = Interop.Call("user32","FindWindowW","msblpopupmsgwclass",0);
if (lngNotify)
{
var showlist = ReadRegistry("showlist");
if (showlist == "False")
{
var c = ":";
var d = new Date();
var s = (d.getHours() < 10) ? "0" + d.getHours() + c : d.getHours() + c;
s += (d.getMinutes() < 10) ? "0" + d.getMinutes() + c : d.getMinutes() + c;
s += (d.getSeconds() < 10) ? "0" + d.getSeconds() : d.getSeconds();
if (show){
try {
PlusWnd.visible = true;
}
catch(e) {
PlusWnd = MsgPlus.CreateWnd("window.xml","msnbox",1);
}
finally {
PlusWnd.visible = false;
MakeWndTransparent(PlusWnd.Handle);
show = true;
}
}
PlusWnd.LstBox_AddItem("lista",s + " > " + strGettext(lngNotify));
PlusWnd.SetControlText("lbltitle", "Notifications: " + PlusWnd.LstBox_GetCount("lista"));
}
else
{
if (!PlusWnd) {
PlusWnd = MsgPlus.CreateWnd("window.xml","msnbox");
PlusWnd.visible=false;
show = false;
}
}
Interop.Call("user32","PostMessageA",lngNotify,16,0,0);
}
MsgPlus.AddTimer("msnpopupspy",100);
}
function strGettext(lngHwnd)
{
var ilngLength = Interop.Call("user32","SendMessageA",lngHwnd,14,0,0);
var strBuffer = "";
for (var x=0; x<ilngLength; x++) strBuffer+=" ";
Interop.Call("user32","SendMessageW",lngHwnd,13,ilngLength+1,strBuffer);
return(strBuffer);
}
function MakeWndTransparent(PlusWnd){
// CODE : MSN PREVIEW BOX SCRIPT
var Msg;
var nMsg = Interop.Allocate(4);
var GWL_STYLE = (-20);
var LWA_ALPHA = 0x2;
var WS_EX_LAYERED = 0x80000;
var WS_EX_TRANSPARENT = 0x20;
Msg = Interop.Call('user32', 'GetWindowLongW', PlusWnd, GWL_STYLE);
nMsg.WriteDWORD(0, (Msg | WS_EX_LAYERED));
Interop.Call('user32', 'SetWindowLongW', PlusWnd, GWL_STYLE, nMsg.ReadDWORD(0));
vis = 1* ( Math.abs(ReadRegistry("opacity")) >=0 && Math.abs(ReadRegistry("opacity")) <256 ? Math.abs(ReadRegistry("opacity")) : 200);
Interop.Call('user32', 'SetLayeredWindowAttributes', PlusWnd, 0, vis, LWA_ALPHA);
}
function WriteRegistry(key, value){
try {
var toReturn = new ActiveXObject("WScript.Shell").RegWrite(MsgPlus.ScriptRegPath + Messenger.MyUserID + "\\" + key, value, "REG_SZ");
}
catch(e) {
var toReturn = 0;
}
finally {
return(toReturn);
}
}
function ReadRegistry(key){
try {
var toReturn = new ActiveXObject("WScript.Shell").RegRead(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\" + key);
}
catch(e) {
var toReturn = 0;
}
finally {
return(toReturn);
}
}
xml code: <Interfaces xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Window Id="msnbox" Version="1">
<Attributes>
<Caption>LOL</Caption>
<TopMost>true</TopMost>
<ShowInTaskbar>false</ShowInTaskbar>
</Attributes>
<TitleBar>
<AllowMinimize>false</AllowMinimize>
<AllowMaximize>false</AllowMaximize>
<AllowClose>false</AllowClose>
</TitleBar>
<Position Width="450" Height="60"/>
<DialogTmpl/>
<WindowTmpl><Corners><RoundSize>1</RoundSize></Corners><Borders><Color><Alpha>255</Alpha></Color></Borders></WindowTmpl>
<Controls>
<Control xsi:type="StaticControl" Id="lbltitle">
<Position Top="1" Left="5" Width="100" Height="55"/>
<Caption>Notifications:</Caption>
</Control>
<Control xsi:type="ListBoxControl" Id="lista">
<Position Top="10" Left="5" Width="438" Height="55"/>
</Control>
</Controls>
</Window>
<Window Id="ui" Version="1">
<Attributes>
<Caption>Configuration</Caption>
</Attributes>
<TitleBar>
<AllowMinimize>false</AllowMinimize>
<AllowMaximize>false</AllowMaximize>
<AllowClose>false</AllowClose>
<Title><Text>Configuration</Text></Title>
</TitleBar>
<Position Width="155" Height="220"/>
<DialogTmpl>
<BottomBar Style="Plain">
<RightControls>
<Control xsi:type="ButtonControl" Id="save">
<Position Top="0" Width="50" Left="80"/>
<Caption>&Save</Caption>
<Attributes>
<IsDefault>true</IsDefault>
</Attributes>
</Control>
<Control xsi:type="ButtonControl" Id="cancel">
<Position Top="0" Width="50" Left="0"/>
<Caption>&Cancel</Caption>
</Control>
</RightControls>
</BottomBar>
</DialogTmpl>
<WindowTmpl></WindowTmpl>
<Elements>
<Element xsi:type="ImageElement" Id="logo">
<Position Top="33" Left="10"/>
<Image><Name>buddy-floatingnickname</Name></Image>
</Element>
</Elements>
<Controls>
<Control xsi:type="StaticControl" Id="lblTitle">
<Position Top="30" Left="30" Width="200" Height="16" />
<Caption>MSN Popup Spy</Caption>
<Transparency>200</Transparency>
<Font><Bold>True</Bold><Size>16</Size></Font>
<Attributes>
<AutoAdjustWidth>true</AutoAdjustWidth>
</Attributes>
</Control>
<Control xsi:type="StaticControl" Id="lbltitle">
<Position Top="45" Width="150" Left="40"/>
<Caption>Configuration</Caption>
<Transparency>130</Transparency>
<Font><Bold>true</Bold><Size>7</Size></Font>
<Attributes>
<AutoAdjustWidth>true</AutoAdjustWidth>
</Attributes>
</Control>
<Control xsi:type="CheckBoxControl" Id="chk">
<Position Top="115" Left="20" Width="125" Height="10"/>
<Caption>Don't Show me the notifications' list</Caption>
</Control>
<Control xsi:type="StaticControl" Id="lbl02">
<Position Top="125" Left="30" Width="80" Height="30"/>
<Caption>Only kill Popups</Caption>
<Transparency>160</Transparency>
</Control>
<Control xsi:type="StaticControl" Id="lblopacity">
<Position Top="76" Width="150" Left="10"/>
<Caption>Window Opacity</Caption>
<Transparency>130</Transparency>
<Font><Bold>true</Bold><Size>7</Size></Font>
<Attributes>
<AutoAdjustWidth>true</AutoAdjustWidth>
</Attributes>
</Control>
<Control xsi:type="StaticControl" Id="lblpopups">
<Position Top="106" Width="150" Left="10"/>
<Caption>MSN Popups</Caption>
<Transparency>130</Transparency>
<Font><Bold>true</Bold><Size>7</Size></Font>
<Attributes>
<AutoAdjustWidth>true</AutoAdjustWidth>
</Attributes>
</Control>
<Control xsi:type="EditControl" Id="wp">
<Position Top="86" Left="20" Width="50" Heitght="11"/>
<Attributes><NumbersOnly>true</NumbersOnly><WantReturn>true</WantReturn></Attributes>
</Control>
<Control xsi:type="StaticControl" Id="alpha">
<Position Top="86" Left="73" Width="80" Height="10"/>
<Caption>0 - 255</Caption>
<Transparency>160</Transparency>
</Control>
</Controls>
</Window>
</Interfaces>
Pretty sure its working bug free but it needs the .xml file to work aswell can that be removed?
RE: Toast popup by Spunky on 11-25-2009 at 10:53 AM
As long as you remove all MsgPlus.CreateWnd functions that refer to it.
I did just write a quick script at work, it is as yet untested though:
js code: var WM_CLOSE = 0x10; // Doesn't need to be defined, but it's just there to explain what it is
function OnEvent_Initialize(){ // On Script start
if(Messenger.MyStatus > 1){ // If we are signed in
OnEvent_SigninReady(Messenger.MyEmail); // Call the event OnEvent_SigninReady
}
}
function OnEvent_SigninReady(){ // When we have signed in
MsgPlus.AddTimer(Messenger.MyUserId, 100); // Start searching using a timer. Using Messenger.MyUserId as the timer's ID. Will be unique to the user, which is useful for checking it was added by the currently logged in user
}
function OnEvent_Timer(ID){ // When the timer fires
var hWnd = Interop.Call("user32", "FindWindowW", "msblpopupmsgwclass", 0); // Find the toast window
if(hWnd != null){ // If we found one
Interop.Call ( 'user32' , 'SendMessageW' , hWnd , WM_CLOSE, 0 , 0 ) ; // Close it
}
MsgPlus.AddTimer(ID, 100); // Repeat the timer
}
function OnEvent_Uninitialize(){ // On script stopped
MsgPlus.CancelTimer(Messenger.MyUserId); // Cancel outstanding timers
}
function OnEvent_Signout(){ // When we have signed out
OnEvent_Uninitialize(); // Cancel outstanding timers
}
RE: Toast popup by SourSpud on 11-25-2009 at 10:57 AM
thanks alot mate its working, and cheers for the comments in the code
RE: Toast popup by CookieRevised on 11-25-2009 at 11:41 AM
quote:
js code: ...
var hWnd = Interop.Call("user32", "FindWindowW", "msblpopupmsgwclass", 0); // Find the toast window
if(hWnd != null){ // If we found one
Interop.Call ( 'user32' , 'SendMessageW' , hWnd , WM_CLOSE, 0 , 0 ) ; // Close it
}
...
You might wanna repeat that until you don't find any windows anymore. There could be multiple toasts at the same moment.
Also, that code is not polygamy safe (every code should be made polygamy safe if possible).
This will fix all that:js code: ...
var tIDCurrent = Interop.Call('Kernel32', 'GetCurrentThreadId');
var hWnd = 0;
while (hWnd = Interop.Call('User32', 'FindWindowW', 'MSBLPopupMsgWClass', 0)) {
if (Interop.Call('User32', 'GetWindowThreadProcessId', hWnd, 0) === tIDCurrent) {
Interop.Call ('User32', 'SendMessageW', hWnd ,WM_CLOSE, 0, 0)
}
}
...
-----
PS: SourSpud, it would still be better to actually turn off the option in Messenger though! Script like this are process intensive and might slow things down because of the use of that timer. Also, Plus! toasts aren't hidden by this. So you still need to disable some options in preferences anyways.
RE: Toast popup by SourSpud on 11-25-2009 at 10:25 PM
thanks for the reply guys, is it possible to hide the toast just from the active window, say only when I receive the first message or if i cloe the conversation, everything else will still show like emails, people signing in ect.
RE: Toast popup by Spunky on 11-25-2009 at 11:33 PM
I think they all have the same parent thread which means there would be no way to distinguish. Using the script you downloaded before, you can copy a function to get the text from the toast and check if it says "X has sent you a message". Once you have received that and closed it, add the user into an array. As long as you check who the toast is off against the array and only close it if it doesn't appear in the array, it'll be ok. Then you can delete the user from the array when the window is closed so that the toasts show again until you close the window...
Actually sounds pretty complicated, but it's not that difficult to be honest... I may try re-wording this post sometime.
If you can't do it I will have a try, but have a go at it first.
RE: Toast popup by SourSpud on 11-26-2009 at 01:26 AM
That sounds way to complicated for a beginner haha
RE: Toast popup by CookieRevised on 11-26-2009 at 02:17 AM
quote: Originally posted by Spunky
you can copy a function to get the text from the toast and check if it says "X has sent you a message". Once you have received that and closed it, add the user into an array.
That wont work... You can have a window in focus which already has a conversation going on.
What you must do (and this is way less complicated; you also don't need any global array at all):
When a toast pops up, check the text of the toast and get the contact's email/name from it. If that email/name is the same as one of the emails/names in the current infocus* chat then hide the toast, if not, let the toast show.
* infocus: meaning all the chat windows (plural!) which are open, thus not minimized when tabbed chatting is disabled. Or the visible chat window (singular) when tabbed chatting is enabled.
PS: Depending on your computer speed it might well be that the toast which needs to be hidden will quite possible still show. This because getting the email/name from it, getting the contacts from the current infocus chats, comparing the two, etc all takes time. And it might well be that by that time the toast is already (partially) displayed.
RE: Toast popup by SourSpud on 11-26-2009 at 04:03 AM
Cookie how about instead of checking the email and stuff just check if the toast contains says: and if it does can we make it hide it if the message contains either hey, hello, hi
but let it show it it contains anything else apart from those 3 words.
RE: Toast popup by CookieRevised on 11-26-2009 at 09:28 AM
quote: Originally posted by SourSpud
Cookie how about instead of checking the email and stuff just check if the toast contains says: and if it does can we make it hide it if the message contains either hey, hello, hi
but let it show it it contains anything else apart from those 3 words.
you can, but I don't see why you want that as that seems very random (eg: what if the contact says "howdy!").
It certainly will not work for what you previously wanted though: hiding toasts for the infocus chat because for that you need to have the email/name from the toast in order to have something to compare to the chat window's contact object.
RE: Toast popup by SourSpud on 11-27-2009 at 07:17 PM
yeah, but 90% of the peolpe either say hey, hi or helllo. I would like to add the others to it as i learn how people say hello to me. as i have a habbit of never closing the chat window anyway while im talking to someone unless the conversation ends.
|