Jump to content
Sign in to follow this  
Ilmari

Option spread calculator

Recommended Posts

Ilmari

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 help

Ilmari

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

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×