Ilmari 0 Posted March 11, 2012 Hi All!I’m trying to do a simple calculator. I want to point out, I’m not a programmer. Is there anyone who can give me a hint how to make a simple script, adding values from two inputs and showing the result on Output Button. ( $OutputNyttaktiepris = $InputAtienspris + $InputpAndringprocent ).So far I have done as below.Thanks for your helpIlmari Func Main() Local $msg, $InputAndringprocent, $OutputNyttaktiepris Local $InputAtienspris, GUICreate("My GUI") ; will create a dialog box that when displayed is centered GUISetState(@SW_SHOW) ; will display an empty dialog box $InputAtienspris= GUICtrlCreateInput("", 100, 35, 50, 20, 21) $InputpAndringprocent = GUICtrlCreateInput("", 195, 35, 50, 20, 21) $OutputNyttaktiepris = GUICtrlCreateButton("", 290, 35, 50, 20, 0x21) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete()EndFunc ;= Share this post Link to post Share on other sites
Jos 2,169 Posted March 11, 2012 Something to study: #include <GUIConstantsEx.au3> ; Main() ; Func Main() Local $msg, $InputAndringprocent, $OutputNyttaktiepris, $bOutputNyttaktiepris, $InputAtienspris GUICreate("My GUI") ; will create a dialog box that when displayed is centered GUISetState(@SW_SHOW) ; will display an empty dialog box $InputAtienspris = GUICtrlCreateInput("", 100, 35, 50, 20, 21) $InputpAndringprocent = GUICtrlCreateInput("", 195, 35, 50, 20, 21) $bOutputNyttaktiepris = GUICtrlCreateButton("calc", 290, 35, 50, 20, 0x21) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $bOutputNyttaktiepris Then $OutputNyttaktiepris = GUICtrlRead($InputAtienspris) * GUICtrlRead($InputpAndringprocent) / 100 MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @LF & '$OutputNyttaktiepris' & @LF & @LF & 'Return:' & @LF & $OutputNyttaktiepris) ;### Debug MSGBOX EndIf WEnd GUIDelete() EndFunc ;==>Main 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. Share this post Link to post Share on other sites
Ilmari 0 Posted March 11, 2012 Tank you, I will check that later. The command...GUICtrlRead($InputAtienspris)... was what I needed. /IImari Share this post Link to post Share on other sites