What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » is there any way to display an alert\message box (MsgBox) in a script?

Pages: (2): « First « 1 [ 2 ] Last »
is there any way to display an alert\message box (MsgBox) in a script?
Author: Message:
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: is there any way to display an alert\message box (MsgBox) in a script?
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";
    }
}
10-21-2006 02:54 PM
Profile PM Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On