Jump to content

Option spread calculator


Recommended Posts

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 ;=

Link to comment
Share on other sites

  • Developers

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...