Tomb Posted February 12, 2008 Share Posted February 12, 2008 i decided i wanted to make my own custom message box that was actually a GUI masked as a msg box so i wrote up this code. i have before never laughed so hard at my own work expandcollapse popup#include <GuiConstants.au3> $GUI = Guicreate("Custom Message Box", 260, 150, -1, -1, BitOR($WS_POPUPWINDOW, $WS_BORDER, $GUI_ONTOP), $WS_EX_STATICEDGE + $WS_EX_TOPMOST) GuiSetState(@SW_SHOW, $GUI) $YES = GuiCtrlCreateButton("Yes", 20, 100, 60, 30) $NO = GuiCtrlCreateButton("No", 100, 100, 60, 30) $PANIC = GuiCtrlCreateButton("Panic!", 180, 100, 60, 30) $LABEL = GuiCtrlCreateLabel("Would you like to hit NO or YES?", 40, 20) Global $NEWLABEL Global $var While 1 $msg = GuiGetMsg() Select Case $msg = $YES Exit Case $msg = $NO Exit Case $msg = $PANIC GUICtrlDelete($YES) GUICtrlDelete($NO) GUICtrlDelete($PANIC) GUICtrlDelete($LABEL) $font="Comic Sans MS" GUISetFont (45, 400, 0, $font) $NEWLABEL = GuiCtrlCreateLabel("PANIC", 30, 30) ExitLoop EndSelect WEnd While 1 $var = $var + 1 If $var = 10 Then Exit Else GUISetBkColor(0x000000, $GUI) GUICtrlSetBkColor(0xff0000, $NEWLABEL) sleep(100) GUISetBkColor(0xff0000, $GUI) GUICtrlSetBkColor(0x000000, $NEWLABEL) sleep(100) EndIf WEnd Link to comment Share on other sites More sharing options...
JustinReno Posted February 12, 2008 Share Posted February 12, 2008 Why is this in GUI Help and Support? Link to comment Share on other sites More sharing options...
Tomb Posted February 12, 2008 Author Share Posted February 12, 2008 Why is this in GUI Help and Support?its a GUI and eh why not.give me support on it MEH Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 12, 2008 Share Posted February 12, 2008 Here is something to laugh on too It's called «Catch me if you can» ... Are you satisfied with your salary? #include <GUIConstants.au3> $Gui = GUICreate("Satisfaction with salary issue", 300, 200) $yes = GUICtrlCreateButton("Yes", 20, 50, 50, 25) $no = GUICtrlCreateButton("No!", 200, 50, 50, 25) $label = GUICtrlCreateLabel("Are you satisfied with your salary?", 50, 10, 200, 20) GUISetState() While 1 $msg = GUIGetMsg() $CurInfo = GUIGetCursorInfo($Gui) If $CurInfo[4] = $no Then $CurrentCoords = ControlGetPos($Gui, "", $no) $Random_Left_Coords = Random(20, 250, 1) $Random_Top_Coords = Random(30, 160, 1) While $Random_Left_Coords > 20 And $Random_Left_Coords < 70 $Random_Left_Coords = Random(20, 250, 1) WEnd While $Random_Top_Coords > 30 And $Random_Top_Coords < 75 $Random_Top_Coords = Random(30, 160, 1) WEnd GUICtrlSetPos($no, $Random_Left_Coords, $Random_Top_Coords) EndIf Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $yes MsgBox(64, "Yes", "We thought so ;)!") ExitLoop EndSelect WEnd This should be in the Example section i think, or even in the Chat  Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1  AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ==================================================    AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Tomb Posted February 12, 2008 Author Share Posted February 12, 2008 Here is something to laugh on too It's called «Catch me if you can» ... Are you satisfied with your salary? #include <GUIConstants.au3> $Gui = GUICreate("Satisfaction with salary issue", 300, 200) $yes = GUICtrlCreateButton("Yes", 20, 50, 50, 25) $no = GUICtrlCreateButton("No!", 200, 50, 50, 25) $label = GUICtrlCreateLabel("Are you satisfied with your salary?", 50, 10, 200, 20) GUISetState() While 1 $msg = GUIGetMsg() $CurInfo = GUIGetCursorInfo($Gui) If $CurInfo[4] = $no Then $CurrentCoords = ControlGetPos($Gui, "", $no) $Random_Left_Coords = Random(20, 250, 1) $Random_Top_Coords = Random(30, 160, 1) While $Random_Left_Coords > 20 And $Random_Left_Coords < 70 $Random_Left_Coords = Random(20, 250, 1) WEnd While $Random_Top_Coords > 30 And $Random_Top_Coords < 75 $Random_Top_Coords = Random(30, 160, 1) WEnd GUICtrlSetPos($no, $Random_Left_Coords, $Random_Top_Coords) EndIf Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $yes MsgBox(64, "Yes", "We thought so ;)!") ExitLoop EndSelect WEnd This should be in the Example section i think, or even in the Chat OMG I LOVE IT that is amazingly LOL Link to comment Share on other sites More sharing options...
Lazycat Posted February 12, 2008 Share Posted February 12, 2008 Here is something to laugh on too It's called «Catch me if you can» ...Yeah, this is classics Recall I added this joke as "easter egg" in one of my early programs. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Kire Posted February 12, 2008 Share Posted February 12, 2008 dont it work or what? Link to comment Share on other sites More sharing options...
ResNullius Posted February 13, 2008 Share Posted February 13, 2008 Here is something to laugh on too It's called «Catch me if you can» ...There is something wrong with your script...I can TAB from the Yes to the NO button and then hit the spacebar to push the No button, but nothing happens! Plz fix it so I can make my dissatisfaction known Link to comment Share on other sites More sharing options...
Tomb Posted February 13, 2008 Author Share Posted February 13, 2008 (edited) There is something wrong with your script... I can TAB from the Yes to the NO button and then hit the spacebar to push the No button, but nothing happens! Plz fix it so I can make my dissatisfaction known just edit it to this expandcollapse popup#include <GUIConstants.au3> $Gui = GUICreate("Satisfaction with salary issue", 300, 200) $yes = GUICtrlCreateButton("Yes", 20, 50, 50, 25) $no = GUICtrlCreateButton("No!", 200, 50, 50, 25) $label = GUICtrlCreateLabel("Are you satisfied with your salary?", 50, 10, 200, 20) GUISetState() While 1 $msg = GUIGetMsg() $CurInfo = GUIGetCursorInfo($Gui) If $CurInfo[4] = $no Then $CurrentCoords = ControlGetPos($Gui, "", $no) $Random_Left_Coords = Random(20, 250, 1) $Random_Top_Coords = Random(30, 160, 1) While $Random_Left_Coords > 20 And $Random_Left_Coords < 70 $Random_Left_Coords = Random(20, 250, 1) WEnd While $Random_Top_Coords > 30 And $Random_Top_Coords < 75 $Random_Top_Coords = Random(30, 160, 1) WEnd GUICtrlSetPos($no, $Random_Left_Coords, $Random_Top_Coords) EndIf Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $yes MsgBox(64, "Yes", "We thought so !") ExitLoop Case $msg = $No MsgBox(64, "No", "We don't care ^ _ ^") ExitLoop EndSelect WEnd Edited February 13, 2008 by Tomb616 Link to comment Share on other sites More sharing options...
Achilles Posted February 14, 2008 Share Posted February 14, 2008 Here is something to laugh on too It's called «Catch me if you can» ... Are you satisfied with your salary? #include <GUIConstants.au3> $Gui = GUICreate("Satisfaction with salary issue", 300, 200) $yes = GUICtrlCreateButton("Yes", 20, 50, 50, 25) $no = GUICtrlCreateButton("No!", 200, 50, 50, 25) $label = GUICtrlCreateLabel("Are you satisfied with your salary?", 50, 10, 200, 20) GUISetState() While 1 $msg = GUIGetMsg() $CurInfo = GUIGetCursorInfo($Gui) If $CurInfo[4] = $no Then $CurrentCoords = ControlGetPos($Gui, "", $no) $Random_Left_Coords = Random(20, 250, 1) $Random_Top_Coords = Random(30, 160, 1) While $Random_Left_Coords > 20 And $Random_Left_Coords < 70 $Random_Left_Coords = Random(20, 250, 1) WEnd While $Random_Top_Coords > 30 And $Random_Top_Coords < 75 $Random_Top_Coords = Random(30, 160, 1) WEnd GUICtrlSetPos($no, $Random_Left_Coords, $Random_Top_Coords) EndIf Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $yes MsgBox(64, "Yes", "We thought so ;)!") ExitLoop EndSelect WEnd This should be in the Example section i think, or even in the Chat That's great! My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 14, 2008 Share Posted February 14, 2008 Plz fix it so I can make my dissatisfaction knownjust edit it to this I got better fix : expandcollapse popup#include <GUIConstants.au3> HotKeySet("^{TAB}", "HotKeys_Event") HotKeySet("+{TAB}", "HotKeys_Event") HotKeySet("{TAB}", "HotKeys_Event") HotKeySet("{Right}", "HotKeys_Event") HotKeySet("{Left}", "HotKeys_Event") HotKeySet("{Up}", "HotKeys_Event") HotKeySet("{Down}", "HotKeys_Event") HotKeySet("{Space}", "HotKeys_Event") HotKeySet("{Enter}", "HotKeys_Event") $Gui = GUICreate("Satisfaction with salary issue", 300, 200) $yes = GUICtrlCreateButton("Yes", 20, 50, 50, 25) $no = GUICtrlCreateButton("No!", 200, 50, 50, 25) $label = GUICtrlCreateLabel("Are you satisfied with your salary?", 50, 10, 200, 20) GUISetState() While 1 $msg = GUIGetMsg() $CurInfo = GUIGetCursorInfo($Gui) If $CurInfo[4] = $no Then $CurrentCoords = ControlGetPos($Gui, "", $no) $Random_Left_Coords = Random(20, 250, 1) $Random_Top_Coords = Random(30, 160, 1) While $Random_Left_Coords > 20 And $Random_Left_Coords < 70 $Random_Left_Coords = Random(20, 250, 1) WEnd While $Random_Top_Coords > 30 And $Random_Top_Coords < 75 $Random_Top_Coords = Random(30, 160, 1) WEnd GUICtrlSetPos($no, $Random_Left_Coords, $Random_Top_Coords) EndIf Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $yes MsgBox(64, "Yes", "We thought so !") ExitLoop Case $msg = $No MsgBox(16, "No", "Unacceptable answer, please try again.") EndSelect WEnd Func HotKeys_Event() If Not WinActive($Gui) Then HotKeySet(@HotKeyPressed) Send(@HotKeyPressed) HotKeySet(@HotKeyPressed, "HotKeys_Event") EndIf EndFunc  Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1  AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ==================================================    AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
ResNullius Posted February 14, 2008 Share Posted February 14, 2008 just edit it to this #include <GUIConstants.au3> ... Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $yes MsgBox(64, "Yes", "We thought so !") ExitLoop Case $msg = $No MsgBox(64, "No", "We don't care ^ _ ^") ExitLoop EndSelect WEndHmmmm, I thought it would be more like this: expandcollapse popup#include <GUIConstants.au3> $Gui = GUICreate("Satisfaction with salary issue", 300, 200) $yes = GUICtrlCreateButton("Yes", 20, 50, 50, 25) $no = GUICtrlCreateButton("No!", 200, 50, 50, 25) $label = GUICtrlCreateLabel("Are you satisfied with your salary?", 50, 10, 200, 20) GUISetState() While 1 $msg = GUIGetMsg() $CurInfo = GUIGetCursorInfo($Gui) If $CurInfo[4] = $no Then $CurrentCoords = ControlGetPos($Gui, "", $no) $Random_Left_Coords = Random(20, 250, 1) $Random_Top_Coords = Random(30, 160, 1) While $Random_Left_Coords > 20 And $Random_Left_Coords < 70 $Random_Left_Coords = Random(20, 250, 1) WEnd While $Random_Top_Coords > 30 And $Random_Top_Coords < 75 $Random_Top_Coords = Random(30, 160, 1) WEnd GUICtrlSetPos($no, $Random_Left_Coords, $Random_Top_Coords) EndIf Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $yes MsgBox(64, "Yes", "We thought so !") ExitLoop Case $msg = $no $YesPos = ControlGetPos($Gui, "", $yes) Opt("MouseCoordMode", 2) MouseMove($YesPos[0] + 10, $YesPos[1] + 10, 40) ControlFocus($Gui, "", $yes) Sleep(300) ControlClick($Gui, "", $yes) EndSelect WEnd Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now