Ilmari Posted March 11, 2012 Share 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 ;= Link to comment Share on other sites More sharing options...
Developers Jos Posted March 11, 2012 Developers Share 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. Link to comment Share on other sites More sharing options...
Ilmari Posted March 11, 2012 Author Share Posted March 11, 2012 Tank you, I will check that later. The command...GUICtrlRead($InputAtienspris)... was what I needed. /IImari 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