창 제목과 내용, 메세지 형식을 디자인하는 툴입니다.
버튼을 클릭하면 미리보기와 클립보드에 소스가 저장이 됩니다.
/*
MsgBox generator by oldbug
http://www.autohotkey.com/forum/viewtopic.php?t=1631&p=9742#9742
Updated/Improved by Philippe Lhoste (PhiLho)
*/
;#################### Form
Gui Add, Text, x16 y7 w60 h15, Title
Gui Add, Text, x16 y50 w60 h15, Message
Gui Add, Edit, vtitle x16 y27 w390 h20,
Gui Add, Edit, vmessage x16 y67 w390 h50,
Gui Add, GroupBox, x16 y127 w190 h145, Buttons
Gui Add, Radio, vbuttonOK Checked x26 y147 w170 h20, OK
Gui Add, Radio, vbuttonOK_Cancel x26 y167 w170 h20, OK/Cancel
Gui Add, Radio, vbuttonAbort_Retry_Ignore x26 y187 w170 h20, Abort/Retry/Ignore
Gui Add, Radio, vbuttonYes_No_Cancel x26 y207 w170 h20, Yes/No/Cancel
Gui Add, Radio, vbuttonYes_No x26 y227 w170 h20, Yes/No
Gui Add, Radio, vbuttonRetry_Cancel x26 y247 w170 h20, Retry/Cancel
Gui Add, GroupBox, x16 y277 w190 h70, Modal
Gui Add, Radio, vmodalTask Checked x26 y297 w170 h20, Task
Gui Add, Radio, vmodalSystem x26 y317 w170 h20, System
Gui Add, GroupBox, x16 y353 w190 h40, Default Button
Gui Add, Radio, vdefault1st Checked x26 y367 w40 h20, 1st
Gui Add, Radio, vdefault2nd x96 y367 w40 h20, 2nd
Gui Add, Radio, vdefault3rd x164 y367 w40 h20, 3rd
Gui Add, GroupBox, x226 y127 w180 h220, Icon
Gui Add, Radio, viconNone Checked x236 y147 w110 h20, None
Gui Add, Radio, viconHand x236 y187 w110 h20, Error
Gui Add, Radio, viconQuestion x236 y227 w110 h20, Question
Gui Add, Radio, viconExclamation x236 y267 w110 h20, Exclamation
Gui Add, Radio, viconAsterisk x236 y307 w110 h20, Asterisk
If A_OSType = WIN32_WINDOWS
{
; Win98
Gui Add, Picture, icon6 x356 y140 w32 h32, user.exe
Gui Add, Picture, icon4 x356 y177 w32 h32, user.exe
Gui Add, Picture, icon3 x356 y217 w32 h32, user.exe
Gui Add, Picture, icon2 x356 y257 w32 h32, user.exe
Gui Add, Picture, icon5 x356 y297 w32 h32, user.exe
}
Else
{
; WinXP
;~ Gui Add, Picture, icon50 x356 y140 w32 h32, shell32.dll
Gui Add, Picture, icon4 x356 y177 w32 h32, user32.dll
Gui Add, Picture, icon3 x356 y217 w32 h32, user32.dll
Gui Add, Picture, icon2 x356 y257 w32 h32, user32.dll
Gui Add, Picture, icon5 x356 y297 w32 h32, user32.dll
}
Gui Add, Button, gTestAndCopy Default x226 y360 w80 h33, Clipboard
Gui Add, Button, gGuiClose x326 y360 w80 h33, Close
Gui Show, x148 y10 h410 w425, MsgBox Code Generator (for AHK)
Return
;#################### Main
TestAndCopy:
Gui Submit, NoHide
;#################### Radio buttons
options =
( Join|
buttonOK=0
buttonOK_Cancel=1
buttonAbort_Retry_Ignore=2
buttonYes_No_Cancel=3
buttonYes_No=4
buttonRetry_Cancel=5
iconNone=0
iconHand=16
iconQuestion=32
iconExclamation=48
iconAsterisk=64
default1st=0
default2nd=256
default3rd=512
modalSystem=4096
modalTask=8192
)
option = 0
; Check for each radio button if it is set, looping on the variable names
Loop Parse, options, |
{
StringSplit option, A_LoopField, =
If (%option1% = 1)
{
option += option2
}
}
;#################### Message
If (InStr(message, "`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 message, message, `n, ``n, All
}
}
;#################### Output
output = MsgBox %option%`, %title%`, %message%
Clipboard = %output%
; Test
FileAppend %output%, %A_ScriptDir%\~msg.tmp
RunWait %A_AhkPath% "%A_ScriptDir%\~msg.tmp"
FileDelete %A_ScriptDir%\~msg.tmp
Return
;#################### Close
GuiClose:
GuiEscape:
FileDelete %A_ScriptDir%\~msg.tmp
ExitApp