[AutoIt] AutoMsg Generator (Can Now Save Code for Popup) 11-14-2011, 11:48 PM
#1
This is One of My First True GUI's. It Generates a Popup Message based on the Title, Message, Icon, and Button Chosen. You Cant Save it, Its Just Something... I Guess. Use it as a Script Example or Something. You Can Save the Code for the Popup As Well
Save this Image is "logo.gif" in the Folder with the AU3 File.
![[Image: mbsd3t.gif]](http://i44.tinypic.com/mbsd3t.gif)
Rate and Comment!
Code:
#include <GUIConstants.au3>
MsgGenGUI()
Func MsgGenGUI()
AutoItSetOption("ExpandVarStrings", 1)
GUICreate("AutoMessage Gen - By ReaperX", 400, 280)
GUICtrlCreatePic("logo.gif", 260, 30, 50, 50)
GUISetBkColor(0xE5AA7A)
; InputBoxes and the Generate and Save Button for the Message.
$generate = GUICtrlCreateButton("Generate Message", 238, 200)
$save = GUICtrlCreateButton("Save Code (.au3)", 241, 230)
$title_label = GUICtrlCreateLabel("Popup Title:", 220, 100)
$popup_title = GUICtrlCreateInput( "", 220, 115, 135)
$text_label = GUICtrlCreateLabel("Popup Message:", 220, 155)
$popup_msg = GUICtrlCreateInput( "", 220, 170, 135)
$about_button = GUICtrlCreateButton("About", 0, 250, 40, 30)
$exit_button = GUICtrlCreateButton("Exit", 80, 250, 40, 30)
$help_button = GUICtrlCreateButton("Help", 40, 250, 40, 30)
; Tab For Choosing the Icon
$icon_tab = GUICtrlCreateTab(0, 0, 200, 250)
$icon_tab_items = GUICtrlCreateTabItem("Choose Icon")
$no_icon = GUICtrlCreateRadio("No Icon", 10, 30)
$stop_sign = GUICtrlCreateRadio("Stop Sign Icon", 10, 50)
$question_mark = GUICtrlCreateRadio("Question Mark Icon", 10, 70)
$exclamation_point = GUICtrlCreateRadio("Exclamation Point Icon", 10, 90)
$info_sign = GUICtrlCreateRadio("Information Sign Icon", 10, 110)
$icon = 0
; Tab For Choosing the button(s)
$button_tab = GUICtrlCreateTab(80, 0)
$button_tab_items = GUICtrlCreateTabItem("Choose Button(s)")
$ok = GUICtrlCreateRadio("Ok Button", 10, 30)
$ok_cancel = GUICtrlCreateRadio("Ok and Cancel", 10, 50)
$abort_retry_ignore = GUICtrlCreateRadio("Abort, Retry, Ignore", 10, 70)
$yes_no_cancel = GUICtrlCreateRadio("Yes, No, Cancel", 10, 90)
$yes_no = GUICtrlCreateRadio("Yes and No", 10, 110)
$retry_cancel = GUICtrlCreateRadio("Retry and Cancel", 10, 130)
$cancel_tryagain_continue = GUICtrlCreateRadio("Cancel, Try Again, Continue", 10, 150)
$default_button_label = GUICtrlCreateLabel("** OK is the Default Button. **", 10, 180)
$button = 0
GUISetState()
AutoItSetOption("ExpandVarStrings")
While 1
$msg = GUIGetMsg()
if $msg = $GUI_EVENT_CLOSE Then ExitLoop
Select
Case $msg = $no_icon
$icon = 0
Case $msg = $stop_sign
$icon = 16
Case $msg = $question_mark
$icon = 32
Case $msg = $exclamation_point
$icon = 48
Case $msg = $info_sign
$icon = 64
Case $msg = $ok
$button = 0
Case $msg = $ok_cancel
$button = 1
Case $msg = $abort_retry_ignore
$button = 2
Case $msg = $yes_no_cancel
$button = 3
Case $msg = $yes_no
$button = 4
Case $msg = $retry_cancel
$button = 5
Case $msg = $cancel_tryagain_continue
$button = 6
Case $msg = $generate
$1 = GUICtrlRead($popup_title)
$2 = GUICtrlRead($popup_msg)
MsgBox($icon+$button, $1, $2)
Case $msg = $about_button
MsgBox(0, "About", "Created By ReaperX (C) 2011.")
Case $msg = $exit_button
$verify = MsgBox(36, "Are You Sure?", "Do You Really Want to Exit?")
if $verify = 6 Then Exit
Case $msg = $help_button
MsgBox(0, "Help: What Do I Do?", "All You Do is Select a Icon for the Popup, Click the Buttons Tab, Then Select the Button(s) for the Popup. Then Enter the Info for Title and Message. Then Click Generate Or Save.")
Case $msg = $save
$flag = $icon+$button
$read1 = GUICtrlRead($popup_title)
$read2 = GUICtrlRead($popup_msg)
FileWrite("Popup.au3", 'MsgBox($flag$, "$read1$", "$read2$")')
MsgBox(0, "Code Saved!", 'Code Saved as "Popup.au3" in Current Folder!')
EndSelect
Wend
EndFuncSave this Image is "logo.gif" in the Folder with the AU3 File.
![[Image: mbsd3t.gif]](http://i44.tinypic.com/mbsd3t.gif)
Rate and Comment!
(This post was last modified: 11-17-2011, 03:28 AM by doojan.)




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)