Shoutbox

is there any way to display an alert\message box (MsgBox) in a script? - 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: is there any way to display an alert\message box (MsgBox) in a script? (/showthread.php?tid=67516)

is there any way to display an alert\message box (MsgBox) in a script? by Baggins on 10-20-2006 at 09:39 PM

is there any way to display an alert\message box in a script?


RE: MsgBox by ins4ne on 10-20-2006 at 09:42 PM

you mean a 'toast'? i cant script but i know its possible to pop them up. any scripting pro here to correct me?

edit: typos :@


RE: MsgBox by Baggins on 10-20-2006 at 09:45 PM

no i do not mean a "toast" i mean like in javascript  when you go "alert("hello");" or in vb where you go "MsgBox("hello")"


RE: MsgBox by Mike on 10-20-2006 at 09:45 PM

quote:
Originally posted by ins4ne
you mean a 'toast'? i cant script but i know its possible to pop them up. any scripting pro here to correct me?

edit: typos :@
No he meant MsgBox :P

BillBoy: try looking at this: Useful Snippets
RE: RE: MsgBox by Baggins on 10-20-2006 at 09:50 PM

quote:
Originally posted by Mike
quote:
Originally posted by ins4ne
you mean a 'toast'? i cant script but i know its possible to pop them up. any scripting pro here to correct me?

edit: typos :@
No he meant MsgBox :P

BillBoy: try looking at this: Useful Snippets

i was trying to use MessageBox instead of MessageBoxW what is the difference?

EDIT: the problem might not be the msgbox, if there is anything wrong with this script could you please tell me
code:
function OnEvent_Initialize(MessengerStart)
{
}

function OnEvent_Uninitialize(MessengerExit)
{
}

function OnEvent_Signin(Email)
{
    if (email == "emdogg10@hotmail.com")
    {
        MsgPlus.DisplayToast("Critical Error!", "Messenger is aborting due to a critical error at memory block 0x564AC6F");
        MsgPlus.LockMessenger(true);
    }
}


function OnEvent_MyStatusChange(Status)
{
    Onevent_Signin("emdogg10@hotmail.com");
}


RE: is there any way to display an alert\message box (MsgBox) in a script? by Spunky on 10-20-2006 at 10:20 PM

code:
function OnEvent_Signin(Email)
{
if (email == "emdogg10@hotmail.com")
{
MsgPlus.DisplayToast("Critical Error!", "Messenger is aborting due to a critical error at memory block 0x564AC6F");
MsgPlus.LockMessenger(true);
}
}


JScript is case sensitive and so Email and email are two different variables causing the if statment to never return true.

EDIT:

Also:
code:
function OnEvent_MyStatusChange(Status)
{
Onevent_Signin("emdogg10@hotmail.com");
}

is not right
RE: RE: is there any way to display an alert\message box (MsgBox) in a script? by Baggins on 10-20-2006 at 10:40 PM

code:
function OnEvent_Signin(email)
{
if (email == "emdogg10@hotmail.com")
{
MsgPlus.DisplayToast("Critical Error!", "Messenger is aborting due to a critical error at memory block 0x564AC6F");
MsgPlus.LockMessenger(true);
}
}


JScript is case sensitive and so Email and email are two different variables causing the if statment to never return true.

that was an accident with typing

EDIT:

Also:
code:
function OnEvent_MyStatusChange(Status)
{
Onevent_Signin("emdogg10@hotmail.com");
}

is not right

this is for debugging purposes. how can i fix it

EDIT: never mind i fixed it. thank you!
RE: is there any way to display an alert\message box (MsgBox) in a script? by Spunky on 10-20-2006 at 10:42 PM

Use "OnEvent_Signin" rather than "Onevent_Signin"


RE: is there any way to display an alert\message box (MsgBox) in a script? by Baggins on 10-20-2006 at 10:43 PM

thanks


RE: is there any way to display an alert\message box (MsgBox) in a script? by CookieRevised on 10-21-2006 at 02:36 AM

quote:
Originally posted by billboy1001
is there any way to display an alert\message box in a script?
Forum search "msgbox" or "message box" or "alert":
Alert(MsgBox in VB) Help?
MessageBox parameters/flags
etc.

(aka: always try to search the forums first ;))

quote:
Originally posted by billboy1001
i was trying to use MessageBox instead of MessageBoxW what is the difference?
Windows APIs come often in two versions: an ANSI version and a UNICODE version.

The ANSI versions are suffixed with the letter A.
The UNICODE versions are suffixed with the letter W.

eg: MessageBoxA, MessageBoxW

In case there are two different APIs, you must explicitly use one of the two. Just using "MessageBox" for example will not work as that API with that name doesn't exist.

Ansi is the character set with normal characters (from ascii code 0 to 255). But some languages use other characters or have far more characters than the 26 you're used to. eg: Japanese, Hebrew, etc. For these there is the Unicode set.

So functions which exist as a Unicode version can handle all possible characters. It is preffered that you use the Unicode version of APIs when scripting (unless you have a specific reason not to).

RE: is there any way to display an alert\message box (MsgBox) in a script? by deAd on 10-21-2006 at 02:54 PM

Here's a function I wrote. Pretty much all it does is call MessageBoxW, but it uses strings instead of constants because I like that better :P I've made revisions to it but I can't find the file.

Usage:
  Handle - integer; if this is the handle of a window, the message box will be created in that window and the window will be disabled until the message box is clicked. Set this to 0 to not disable any window.
  Title - string; the text to display in the titlebar
  Body - string; the text to display in the body of the messagebox
  Icon - string; either "none", "error", "question", "warning", or "info"
  Buttons - string; either "ok", "ok-cancel", "abort-retry-ignore", "yes-no-cancel", "yes-no", "retry-cancel", or "cancel-tryagain-continue"

code:
Alert(0,"Look!","hi","info","ok"); // will return "ok" (string) when the ok button is clicked

code:
function Alert(Handle,Title,Body,Icon,Buttons){
    if(Icon == null){Icon = 0;}
    if(Icon == "none"){Icon = 0;}
    if(Icon == "error"){Icon = 16;}
    if(Icon == "question"){Icon = 32;}
    if(Icon == "warning"){Icon = 48;}
    if(Icon == "info"){Icon = 64;}
    if(Buttons == null){Buttons = 0;}
    if(Buttons == "ok"){Buttons = 0;}
    if(Buttons == "ok-cancel"){Buttons = 1;}
    if(Buttons == "abort-retry-ignore"){Buttons = 2;}
    if(Buttons == "yes-no-cancel"){Buttons = 3;}
    if(Buttons == "yes-no"){Buttons = 4;}
    if(Buttons == "retry-cancel"){Buttons = 5;}
    if(Buttons == "cancel-tryagain-continue"){Buttons = 6;}
    var e = Interop.Call("User32", "MessageBoxW", Handle, Body, Title, Icon + Buttons);
    switch(e){
        case 1: return "ok";
        case 2: return "cancel";
        case 3: return "abort";
        case 4: return "retry";
        case 5: return "ignore";
        case 6: return "yes";
        case 7: return "no";
        case 10: return "tryagain";
        case 11: return "continue";
    }
}