I've coded (albeit not professional looking/coding) Message Box Maker for myself and others. I always had to reference the HelpDoc when wanting to make a specific MsgBox (specifically the Icons) so I decided to try my hand at a generator.
If you care to update the code, or better it in any way, I apreciate it. Otherwise, Enjoy.
Code:
; Title : AHK MsgBox Maker
; Version : 1.0
; Author : Travley
; Coded In : AHK (AutoHotKey.Com)
; Notes : Thanks to the AHK Forums
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#SingleInstance Force
DDLMenu = OK||OK/Cancel|Abort/Retry/Ignore|Yes/No/Cancel|Yes/No|Retry/Cancel|Cancel/Try Again/Continue
Gui, Add, Picture, x26 y30 w275 h35 , icons.png
Gui, Add, Text, x6 y112 w75 h20 , MsgBox Text :
Gui, Add, DropDownList, x6 y7 w300 h250 vDDLChoice, %DDLMenu%
Gui, Add, Radio, x6 y37 w20 h20 vRadio1,
Gui, Add, Radio, x86 y37 w20 h20 vRadio2,
Gui, Add, Radio, x166 y37 w20 h20 vRadio3,
Gui, Add, Radio, x246 y37 w20 h20 vRadio4,
Gui, Add, CheckBox, x6 y67 w100 h20 vCheckstate, Always On Top
Gui, Add, CheckBox, x116 y67 w100 h20 VCheckstate2, Timeout (in sec)
Gui, Add, Edit, x216 y67 w90 h20 vTimerEditBox,
Gui, Add, Edit, x56 y90 w250 h20 vTitle,
Gui, Add, Edit, x6 y127 w300 h140 vText,
Gui, Add, Text, x6 y92 w50 h20 , Box Title :
Gui, Add, Button, x26 y297 w100 h30 gPreview, Preview
Gui, Add, Button, x166 y297 w100 h30 gGenerate, Generate
Gui, Add, Edit, x6 y270 w189 h20 vCodePreview, MsgBox Code
Gui, Add, Button, x199 y270 w110 h20 gCopy2Clip, Copy to Clipboard
Gui, Show, x326 y202 h331 w312, AHK MsgBox Maker - by Travley
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GuiClose:
ExitApp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Preview:
Gosub, Generate
FileDelete %TEMP%\mbmtemp.ahk
FileAppend,
(
MsgBox, %Options%, %Title%, %Text%, %Timeout%
), %TEMP%\mbmtemp.ahk
run %TEMP%\mbmtemp.ahk
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Copy2Clip:
GuiControlGet, mbmtemp, , CodePreview
Clipboard := mbmtemp
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Generate:
GuiControlGet, Title
Gosub, GetText
Gosub, OptionsStep1
Gosub, OptionsStep2
Gosub, OptionsStep3
Gosub, TimeOutChecker
Options := Options1 + Options2 + Options3 ; Add All Options Together
GuiControl, , CodePreview, MsgBox, %Options%, %Title%, %Text%, %Timeout%
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
OptionsStep1: ; Convert Buttons to Numbers
guicontrolget, DDLChoice
IfEqual, DDLChoice, OK
{
Options1 = 0
}
IfEqual, DDLChoice, OK/Cancel
{
Options1 = 1
}
IfEqual, DDLChoice, Abort/Retry/Ignore
{
Options1 = 2
}
IfEqual, DDLChoice, Yes/No/Cancel
{
Options1 = 3
}
IfEqual, DDLChoice, Yes/No
{
Options1 = 4
}
IfEqual, DDLChoice, Retry/Cancel
{
Options1 = 5
}
IfEqual, DDLChoice, Cancel/Try Again/Continue
{
Options1 = 6
}
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
OptionsStep2: ; Convert Icons to Numbers
guicontrolget, Radio1
if Radio1 = 1
{
Options2 = 16
}
guicontrolget, Radio2
if Radio2 = 1
{
Options2 = 32
}
guicontrolget, Radio3
if Radio3 = 1
{
Options2 = 48
}
guicontrolget, Radio4
if Radio4 = 1
{
Options2 = 64
}
IfEqual, Options2,
{
Options2 = 0
}
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
OptionsStep3: ; Convert AOT to Number
guicontrolget, Checkstate
If CheckState = 0
{
Options3 = 0
}
Else
{
Options3 = 4096
}
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TimeOutChecker: ; Check & Submit TimeOut Sec
GuiControlGet, Checkstate2
If Checkstate2 = 1
{
GuiControlGet, TimerEditBox
Timeout = %TimerEditBox%
}
Else
{
Timeout =
}
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GetText:
GuiControlGet, Text
If (InStr(Text, "`n"))
{
; Multiline
If (StrLen(message) > 78)
{
; Long message: use a continuation section
message = `n(`n%message%`n)
}
Else
{
; Replace newlines by the corresponding AHK escape sequence
StringReplace Text, Text, `n, ``n, All
}
}
Return