This is another of those scripts made for developers (and another one based on Message Boxes
)... It allows you to create your own custom alerts and receive input from the user. All it requires is that you include one extra js file and one extra xml (and some SMALL images (3.29kb)) with your script. It saves the need for all those Interop.Call(s) to MessageBoxW and having to discover the right paramaters (such as which number you need for certain buttons). The syntax for the command is:
code:
function alert(
sID [String], //Unique ID of the MessageBox (for user identification)
nButtons [Number], //Number of buttons
sTitle [String], //MessageBox title (RichStaticControl)
sMessage [String], //MessageBox message (RichStaticControl)
nIcon [Number], //1-Information | 2-Question | 4-Exclamation | 8-Critical
sButton1 [String], //Button1 Text
sButton2 [String, Optional], //Button2 Text
sButton3 [String, Optional], //Button3 Text
nTrans [Number, Optional], //Transparancy (Percentage)
);
Even though it says number for some of them, I delberately made it accept strings incase the developer was a n00b
As it's just a PlusWnd, it has the same events. To detect a selection or a button press just use:
code:
function OnMessageBoxEvent_CtrlClicked(PlusWnd, ControlId){
...
...
}
This function is already in the js file
I have included the sID paramater so you can distinguish between message boxes (you might have two open at once, if you really need it, and one could be called "error_interop" and the other "savesettings").
Rather than checking for the ControlId in that function I have added a line that retrieves the caption of the button (which is set by you anyway). That way it doesn't get confusing about which buttons were shown and you can check for "Yes" or "No" rather than "btn_1" or "btn_2" etc.
You can also set the transparency of the window (using a function written by Matty) by setting the nTrans param to a number between 0 and 100.
Images can be edited and you can even, with a little bit of tweaking within the script, add more images.
The MessageBox uses RichStaticControls to support colours and other formatting styles.
The window uses the "Flair" style used in stickynotes, even if you can't really see it, I should credit deAd for it
Two Examples of the possibilities:
I hope people like it now (just spent 6 hours on it (kinda)
)