pshankland Posted October 12, 2006 Share Posted October 12, 2006 I am trying to get a simple form to show and then quit with the OK button but keep getting the following error: Func OKButton() Error: "If" statement has no matching "EndIf" statement. The code I have is: #include <includes\GUIConstants.au3> If 1 = 2 Then Exit Else Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $frmPatternError = GUICreate("Pattern Error!!", 344, 101, 193, 115) $lblLabel1 = GUICtrlCreateLabel("Pattern Does Not Match", 72, 8, 197, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $lblLabel2 = GUICtrlCreateLabel("Please contact Prod Eng", 8, 32, 327, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $btnOK = GUICtrlCreateButton("OK", 128, 64, 75, 25, 0) GUICtrlSetOnEvent($btnOK, "OKButton") GUISetState(@SW_SHOW) While 1 Sleep(1000) WEnd Func OKButton() Exit EndFunc EndIf nyone help as I can't seem to get this working. I know it should be an easy fix - just can't see it. Thanks. Pete. Link to comment Share on other sites More sharing options...
Valuater Posted October 12, 2006 Share Posted October 12, 2006 move the function... Func OKButton() Exit EndFunc OUTSIDE (below or after ) the endif a function should be all by itself 8) Link to comment Share on other sites More sharing options...
pshankland Posted October 12, 2006 Author Share Posted October 12, 2006 Is there anyway I could include a simple form with an Quit button inside the If loop, ie without using a function? Thanks. Pete. Link to comment Share on other sites More sharing options...
ChiDragon Posted October 12, 2006 Share Posted October 12, 2006 Why do you want to declare it inside the If statement? Link to comment Share on other sites More sharing options...
pshankland Posted October 12, 2006 Author Share Posted October 12, 2006 Why do you want to declare it inside the If statement?Simply so that if the first instance isn't true then inform the user of the problem and close the program Link to comment Share on other sites More sharing options...
xcal Posted October 12, 2006 Share Posted October 12, 2006 #include <GUIConstants.au3> If 1 = 2 Then Exit Else Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $frmPatternError = GUICreate("Pattern Error!!", 344, 101, 193, 115) $lblLabel1 = GUICtrlCreateLabel("Pattern Does Not Match", 72, 8, 197, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $lblLabel2 = GUICtrlCreateLabel("Please contact Prod Eng", 8, 32, 327, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $btnOK = GUICtrlCreateButton("OK", 128, 64, 75, 25, 0) GUICtrlSetOnEvent($btnOK, "OKButton") GUISetState(@SW_SHOW) EndIf While 1 Sleep(1000) WEnd Func OKButton() Exit EndFunc Why not just use a msgbox(), though? How To Ask Questions The Smart Way 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