LongBowNZ Posted July 31, 2007 Share Posted July 31, 2007 When I convert 200 Celsius to Fahrenheit it displays 39.2 but 200°C is 392°F. I don't know what is wrong since I'm 99% sure I've got the maths right. #NoTrayIcon #include <GUIConstants.au3> #include <Math.au3> GUICreate("Conversion", 480, 50, -1, -1,$WS_POPUP) GUISetBkColor("0xAAAAFF") GUISetState() $Group = GUICtrlCreateGroup("Conversion", 0, 0, 480, 50) $Input = GUICtrlCreateInput("Enter Number", 10, 20, 90, 20) #region Conversion Data $cn1 = "Celsius to Fahrenheit" $cr1 = $Input*1.8+32 $cn2 = "Fahrenheit to Celsius" $cr2 = ($Input-32)/1.8 #endregion Conversion Data $Combo = GUICtrlCreateCombo("", 110, 20, 300, 21) GUICtrlSetData($Combo, $cn1 & "|" & $cn2) $Button = GUICtrlCreateButton("Convert", 420, 20, 50, 20) $Exit = GUICtrlCreateButton("X", 465, 1, 14, 14) While 1 $msg = GUIGetMsg() If $msg = $Exit Then ExitLoop EndIf If $msg = $Button Then Switch GUICtrlRead($Combo) Case $cn1 MsgBox(0, "Result", $cr1) Case $cn2 MsgBox(0, "Result", $cr2) EndSwitch EndIf WEnd Exit Link to comment Share on other sites More sharing options...
qazwsx Posted July 31, 2007 Share Posted July 31, 2007 does it work from Fahrenheit to Celsius? Link to comment Share on other sites More sharing options...
Developers Jos Posted July 31, 2007 Developers Share Posted July 31, 2007 (edited) Use GuiCtrlRead($input) to retrieve the entered value ... ... and this needs to be done when the button is clicked ... Edited July 31, 2007 by JdeB 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. Link to comment Share on other sites More sharing options...
DW1 Posted July 31, 2007 Share Posted July 31, 2007 expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> #include <Math.au3> GUICreate("Conversion", 480, 50, -1, -1,$WS_POPUP) GUISetBkColor("0xAAAAFF") GUISetState() $Group = GUICtrlCreateGroup("Conversion", 0, 0, 480, 50) $Input = GUICtrlCreateInput("Enter Number", 10, 20, 90, 20) #region Conversion Data $cn1 = "Celsius to Fahrenheit" $cn2 = "Fahrenheit to Celsius" #endregion Conversion Data $Combo = GUICtrlCreateCombo("", 110, 20, 300, 21) GUICtrlSetData($Combo, $cn1 & "|" & $cn2) $Button = GUICtrlCreateButton("Convert", 420, 20, 50, 20) $Exit = GUICtrlCreateButton("X", 465, 1, 14, 14) While 1 $msg = GUIGetMsg() If $msg = $Exit Then ExitLoop EndIf If $msg = $Button Then $cr1 = GUICtrlRead($Input)*1.8+32 $cr2 = (GUICtrlRead($Input)-32)/1.8 Switch GUICtrlRead($Combo) Case $cn1 MsgBox(0, "Result", $cr1) Case $cn2 MsgBox(0, "Result", $cr2) EndSwitch EndIf WEnd Exit AutoIt3 Online Help Link to comment Share on other sites More sharing options...
LongBowNZ Posted July 31, 2007 Author Share Posted July 31, 2007 Thanks JdeB for trying to explain it to me. Thanks danwilli for the code cause I couldn't do what JdeB said, I was nearly there but would have taken a few hours to figure it out. Link to comment Share on other sites More sharing options...
DW1 Posted July 31, 2007 Share Posted July 31, 2007 No prob... JdeB is the man. He knows a LOT. If you haven't already been welcomed: Welcome to the AutoIt forum AutoIt3 Online Help Link to comment Share on other sites More sharing options...
LongBowNZ Posted July 31, 2007 Author Share Posted July 31, 2007 No prob... JdeB is the man. He knows a LOT.1 thing he doesn't know is how noob I am If you haven't already been welcomed:Welcome to the AutoIt forumThanks Link to comment Share on other sites More sharing options...
Developers Jos Posted July 31, 2007 Developers Share Posted July 31, 2007 1 thing he doesn't know is how noob I am just want to give you a chance to sort it out first yourself ... or maybe I am just lazy 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. Link to comment Share on other sites More sharing options...
LongBowNZ Posted July 31, 2007 Author Share Posted July 31, 2007 just want to give you a chance to sort it out first yourself ... or maybe I am just lazy lol, thanks anyway 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