Infinitex0 Posted February 12, 2006 Posted February 12, 2006 #include <GUIConstants.au3> GUICreate("Formula For Area Of Triangle", 125, 125) GUICtrlCreateLabel("Input", -1, -1) GUICtrlSetState(-1,$GUI_ACCEPTFILES) $btnB = GUICtrlCreateInput ("Base", 10, 35, 50, 20) ; will not accept drag&drop files $btnH = GUICtrlCreateInput ("Height", 10, 60, 50, 20) $btn = GUICtrlCreateButton ("Ok", 10, 90, 60, 20) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn exitloop EndSelect Wend MsgBox (4096, "Area ='s", GUICtrlRead($btnB)*($btnH)) Whenever I fill in the Blanks (Example: "1" and "2") I get 5. Well not only 5 But every number has five in it 5,10,15,20,25. Anyone know whats wrong? P.S. I know you have to divide by 2 The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]
Developers Jos Posted February 12, 2006 Developers Posted February 12, 2006 Maybe: MsgBox (4096, "Area ='s", GUICtrlRead($btnB)*GUICtrlRead($btnH)) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Infinitex0 Posted February 12, 2006 Author Posted February 12, 2006 Thanks, JdeB The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]
The Kandie Man Posted February 12, 2006 Posted February 12, 2006 Ok, you weren't reading the control text on the second one. I bet that has something to do with it. Also, i had it return a numeric expression so that it wouldn't error out if someone entered text into the boxes. I also moved the message box inside the case select statement so the program wouldn't close everytime you computed the answer. These are just recommendations though. I hope they help. #include <GUIConstants.au3> GUICreate("Formula For Area Of Triangle", 125, 125) GUICtrlCreateLabel("Input", -1, -1) GUICtrlSetState(-1,$GUI_ACCEPTFILES) $btnB = GUICtrlCreateInput ("Base", 10, 35, 50, 20) ; will not accept drag&drop files $btnH = GUICtrlCreateInput ("Height", 10, 60, 50, 20) $btn = GUICtrlCreateButton ("Ok", 10, 90, 60, 20) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn MsgBox (4096, "Area ='s", Number(GUICtrlRead($btnB))*Number(GUICtrlREad($btnH))) EndSelect Wend "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire
Infinitex0 Posted February 13, 2006 Author Posted February 13, 2006 expandcollapse popup#include <GUIConstants.au3> GUICreate("Formula Machine 1.0", 240, 125) $Tri = GUICtrlCreateButton("Triangles", 1, 1) $Squ = GUICtrlCreateButton("Squares", 1, 100) $Rec = GUICtrlCreateButton("Rectangle", 80, 50) GUISetState(@SW_SHOW) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $Tri GUICreate("Calculate Area Of Triangle", 125, 125) GUICtrlCreateLabel("Input", -1, -1) GUICtrlSetState(-1,$GUI_ACCEPTFILES) $btnB = GUICtrlCreateInput("Base", 10, 35, 50, 20) ; will not accept drag&drop files $btnH = GUICtrlCreateInput("Height", 10, 60, 50, 20) $btn1 = GUICtrlCreateButton ("Ok", 10, 90, 60, 20) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn1 ExitLoop EndSelect WEnd MsgBox (4096, "Area ='s", GUICtrlRead($btnB)*GUICtrlRead($btnH)/2) Case $msg = $Squ GUICreate("Formula For Area Of Square", 125, 125) GUICtrlCreateLabel("Input", -1, -1) GUICtrlSetState(-1,$GUI_ACCEPTFILES) $btnS = GUICtrlCreateInput( "Side", 10, 35, 50, 20) $btn2 = GUICtrlCreateButton("Ok", 10, 60, 50, 20) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn2 MsgBox (4096, "Area ='s", GUICtrlRead($btnS)*GUICtrlRead($btnS)) EndSelect WEnd EndSelect WEnd GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $Rec GUICreate("Calculate Area Of Rectangle", 125, 125) GUICtrlCreateLabel("Input", -1, -1) GUICtrlSetState(-1,$GUI_ACCEPTFILES) $btnD = GUICtrlCreateInput("A", 10, 35, 50, 20) ; will not accept drag&drop files $btnD2 = GUICtrlCreateInput("B", 10, 60, 50, 20) $btnZ = GUICtrlCreateButton ("Ok", 50, 90, 60, 20) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btnZ MsgBox (4096, "Area ='s", GUICtrlRead($btnD)*GUICtrlRead($btnD2)) EndSelect WEnd EndSelect WEnd Whenever I press the Rectangle button nothing happens. Any idea why? The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]
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