jbsoccerbrit Posted January 27, 2010 Share Posted January 27, 2010 (edited) I've been tasked with writing a help section for a tool we use at work and can see the Help button listing $helpButton = GUICtrlCreateButton("Help", 10, 67, 151, 20) but I have no idea how to make a MsgBox come up when the button is pressed. I tried a google search and forum search, any help would be great. Thanks. expandcollapse popup#include <GUIConstants.au3> #include <IE.au3> $me = GUICreate("Desktop 1040 Return Generator", 450, 200) GUISetBkColor(0xFFFFFF) ; background color $textbox1 = GUICtrlCreateEdit("", 10, 90, 430, 100) $Pic1 = GUICtrlCreatePic("image.jpg", 300, 1, 141, 42) $Labelnumberstart = GUICtrlCreateLabel("number Start", 10, 1, 60, 20) $Estart = GUICtrlCreateInput("000-00-", 75, 1, 45, 20) $Eend = (GUICtrlCreateInput("0000", 125, 1, 40, 20)) $LabelAnount = GUICtrlCreateLabel("# ", 10, 25, 60, 20) $amount = GUICtrlCreateInput("000", 75, 25, 30, 20) $newReturn = GUICtrlCreateButton("Create ", 10, 47, 151, 20) $helpButton = GUICtrlCreateButton("Help", 10, 67, 151, 20) fRunGui() Func fRunGui() GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ; closes when red x is pressed ExitLoop Case $msg = $newReturn GUICtrlSetData($textbox1, "");deletes the text openRetrun() Case Else ;;; EndSelect WEnd EndFunc ;==>fRunGui Func openRetrun() $iCount = 0 For $count = 0 To GUICtrlRead($amount) - 1 Step 1 $numberEnd = GUICtrlRead($Eend) + $count While StringLen($numberEnd) < 4 $numberEnd = "0" & $numberEnd WEnd $number = GUICtrlRead($Estart) & $numberEnd fThrowError(@ScriptLineNumber, WinActivate("product 2009 :", "")) Send("^n") fThrowError(@ScriptLineNumber, WinWaitActive("Enter number", "", 10)) fThrowError(@ScriptLineNumber, ControlSetText("Enter number", "", "TMaskEdit3", $number)) fThrowError(@ScriptLineNumber, ControlSetText("Enter number", "", "TMaskEdit1", $number)) Send("{TAB}") If (WinExists("Confirm", "&Yes")) Then fThrowError(@ScriptLineNumber, WinActivate("Confirm", "&Yes")) fThrowError(@ScriptLineNumber, ControlClick("Confirm", "", "TButton1", "left", 1)) fThrowError(@ScriptLineNumber, WinWaitActive("Enter number", "", 10)) fThrowError(@ScriptLineNumber, ControlClick("Enter number", "", "TButton3", "left", 1)) GUICtrlSetData($textbox1, "- - - - The return " & $number & " already exists" & @CRLF, 1) Else fThrowError(@ScriptLineNumber, ControlClick("Enter number", "", "TButton4", "left", 1)) fThrowError(@ScriptLineNumber, WinWaitActive("product 2009 :", "pnlNavigation", 10)) Send("!f") Send("c") fThrowError(@ScriptLineNumber, WinWaitActive("product 2009 :", "homepage.htm", 10)) GUICtrlSetData($textbox1, "- - - - The return " & $number & " Created" & @CRLF, 1) $iCount = $iCount + 1 EndIf Next; end of for statement GUICtrlSetData($textbox1, "A total of " & $iCount & " returns were created" & @CRLF, 1) EndFunc ;==>openRetrun Func fThrowError($sMessage, $iZero) If ($iZero = 0) Then MsgBox(1, "Error", "Please restart tool... Speak to Mark or James in regards to further help. " & $sMessage) fRunGui() Exit EndIf EndFunc ;==>fThrowError Exit Edited January 27, 2010 by jbsoccerbrit Link to comment Share on other sites More sharing options...
Fire Posted January 27, 2010 Share Posted January 27, 2010 (edited) expandcollapse popup#include <GUIConstants.au3> #include <IE.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $me = GUICreate("Desktop 1040 Return Generator", 450, 200) GUISetBkColor(0xFFFFFF) ; background color $textbox1 = GUICtrlCreateEdit("", 10, 90, 430, 100) $Pic1 = GUICtrlCreatePic("image.jpg", 300, 1, 141, 42) $Labelnumberstart = GUICtrlCreateLabel("number Start", 10, 1, 60, 20) $Estart = GUICtrlCreateInput("000-00-", 75, 1, 45, 20) $Eend = (GUICtrlCreateInput("0000", 125, 1, 40, 20)) $LabelAnount = GUICtrlCreateLabel("# ", 10, 25, 60, 20) $amount = GUICtrlCreateInput("000", 75, 25, 30, 20) $newReturn = GUICtrlCreateButton("Create ", 10, 47, 151, 20) $helpButton = GUICtrlCreateButton("Help", 10, 67, 151, 20) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ; closes when red x is pressed Exit Case $helpButton MsgBox(64,"HERE I`M","HERE I`M MSGBOX") Case $newReturn GUICtrlSetData($textbox1, "");deletes the text openRetrun() EndSwitch WEnd Func openRetrun() $iCount = 0 For $count = 0 To GUICtrlRead($amount) - 1 Step 1 $numberEnd = GUICtrlRead($Eend) + $count While StringLen($numberEnd) < 4 $numberEnd = "0" & $numberEnd WEnd $number = GUICtrlRead($Estart) & $numberEnd fThrowError(@ScriptLineNumber, WinActivate("product 2009 :", "")) Send("^n") fThrowError(@ScriptLineNumber, WinWaitActive("Enter number", "", 10)) fThrowError(@ScriptLineNumber, ControlSetText("Enter number", "", "TMaskEdit3", $number)) fThrowError(@ScriptLineNumber, ControlSetText("Enter number", "", "TMaskEdit1", $number)) Send("{TAB}") If (WinExists("Confirm", "&Yes")) Then fThrowError(@ScriptLineNumber, WinActivate("Confirm", "&Yes")) fThrowError(@ScriptLineNumber, ControlClick("Confirm", "", "TButton1", "left", 1)) fThrowError(@ScriptLineNumber, WinWaitActive("Enter number", "", 10)) fThrowError(@ScriptLineNumber, ControlClick("Enter number", "", "TButton3", "left", 1)) GUICtrlSetData($textbox1, "- - - - The return " & $number & " already exists" & @CRLF, 1) Else fThrowError(@ScriptLineNumber, ControlClick("Enter number", "", "TButton4", "left", 1)) fThrowError(@ScriptLineNumber, WinWaitActive("product 2009 :", "pnlNavigation", 10)) Send("!f") Send("c") fThrowError(@ScriptLineNumber, WinWaitActive("product 2009 :", "homepage.htm", 10)) GUICtrlSetData($textbox1, "- - - - The return " & $number & " Created" & @CRLF, 1) $iCount = $iCount + 1 EndIf Next; end of for statement GUICtrlSetData($textbox1, "A total of " & $iCount & " returns were created" & @CRLF, 1) EndFunc ;==>openRetrun Func fThrowError($sMessage, $iZero) If ($iZero = 0) Then MsgBox(1, "Error", "Please restart tool... Speak to Mark or James in regards to further help. " & $sMessage) Exit EndIf EndFunc ;==>fThrowError Edited January 27, 2010 by Sh3llC043r [size="5"] [/size] Link to comment Share on other sites More sharing options...
kaotkbliss Posted January 27, 2010 Share Posted January 27, 2010 case $msg=$helpButton msgbox(0,"title","text") ?? 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
jbsoccerbrit Posted January 27, 2010 Author Share Posted January 27, 2010 Thank you very much for the prompt response.... works like a charm and makes my life easier. Again thank you 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