Variabeln nicht deklariert? / Rechnung aktualisieren

  • Hallo,

    wahrscheinlich eie simple Frage: Mein Script meint, dass ich $Button1 etc. nicht deklariert hab, obwohl es so ist. :S

    Naja hier das Script, hoffentlich könnt ihr mir helfen.


    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_icon=images\icon.ico
    #AutoIt3Wrapper_outfile=Widerstandsberechner.exe
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_UseAnsi=y
    #AutoIt3Wrapper_Res_LegalCopyright=xxx
    #AutoIt3Wrapper_Res_Language=1031
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <GDIPlus.au3>
    #include <EditConstants.au3>
    #include <ComboConstants.au3>
    #Include <Constants.au3>
    Opt("TrayMenuMode",1)
    Global $aLabel[10] = ['Schwarz','Braun','Rot','Orange','Gelb','Grün','Blau','Violett','Grau','Weiß']
    Global $bLabel[8] = ['Keine', 'Silber', 'Gold','Braun','Rot','Grün','Blau','Violett']
    Global $cLabel[9] = ['Braun','Rot','Orange','Gelb','Grün','Blau','Violett','Grau','Weiß']
    Global $dLabel[12] = ['Silber', 'Gold', 'Schwarz','Braun','Rot','Orange','Gelb','Grün','Blau','Violett','Grau','Weiß']

    [/autoit] [autoit][/autoit] [autoit]

    Global $eLabel[9] = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
    Global $fLabel [10] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
    Global $gLabel [12] = ['0,01', '0,1', '1', '10', '100', '1000', '10000', '100000', '1000000', '10000000', '100000000', '1000000000']
    Global $hLabel [8] = ['20', '10', '5', '1', '2', '0,5', '0,25', '0,1']
    ;------------------------------------------------------------------------------------------------------------
    TraySetIcon(@Scriptdir & "\Images\icon.ico")
    TrayTip("Copyright (c) 2009","...",2,1)
    _intro()
    _gui()
    ;------------------------------------------------------------------------------------------------------------
    Func _gui()
    #Region ### START Koda GUI section ### Form=c:\users\rouven\desktop\form1.kxf
    $Form1 = GUICreate("Widerstandberechner", 700, 304, -1, -1,-1)
    GUISetBkColor(0xFDFDFD)
    $Ringanzahl = GUICtrlCreateLabel("Ringanzahl:", 446, 48, 89, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    GUICtrlCreateCombo("", 544, 45, 49, 5, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$WS_VSCROLL))
    GUICtrlSetFont(-1, 10, 400, 0, "arial")
    GUICtrlSetData(-1, " 4| 5", " 4")

    [/autoit] [autoit][/autoit] [autoit]

    $Input6 = GUICtrlCreateInput("", 40, 120, 97, 21, $ES_READONLY)
    $Blind_Input3 = GUICtrlCreateInput("",153,120,1,21)
    $Updown1 = GUICtrlCreateUpdown($Blind_Input3)
    GUICtrlSetLimit(-1, 8, 0)
    GUICtrlSetData($Input6, $cLabel[0])
    $Input7 = GUICtrlCreateInput("", 170, 120, 97, 21, $ES_READONLY)
    $Blind_Input4 = GUICtrlCreateInput("",283, 120, 1, 21)
    $Updown2 = GUICtrlCreateUpdown($Blind_Input4)
    GUICtrlSetLimit(-1, 9, 0)
    GUICtrlSetData($Input7, $aLabel[0])
    $Input8 = GUICtrlCreateInput("", 300, 120, 97, 21, $ES_READONLY)
    $Blind_Input5 = GUICtrlCreateInput("", 413, 120, 1, 21)
    $Updown3 = GUICtrlCreateUpdown($Blind_Input5)
    GUICtrlSetLimit(-1, 9, 0)
    GUICtrlSetData($Input8, $aLabel[0])
    $Input9 = GUICtrlCreateInput("", 430, 120, 97, 21, $ES_READONLY)
    $Blind_Input6 = GUICtrlCreateInput("", 543, 120, 1, 21)
    $Updown4 = GUICtrlCreateUpdown($Blind_Input6)
    GUICtrlSetLimit(-1, 11, 0)
    GUICtrlSetData($Input9, $dLabel[0])
    $Input10 = GUICtrlCreateInput("", 560, 120, 97, 21, $ES_READONLY)
    $Blind_Input7 = GUICtrlCreateInput("", 673, 120, 1, 21)
    $Updown5 = GUICtrlCreateUpdown($Blind_Input7)
    GUICtrlSetLimit(-1, 7, 0)
    GUICtrlSetData($Input10, $bLabel[0])

    [/autoit] [autoit][/autoit] [autoit]

    $Label1 = GUICtrlCreateLabel("Toleranz", 573, 96, 66, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label2 = GUICtrlCreateLabel("2. Ziffer", 183, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label3 = GUICtrlCreateLabel("3. Ziffer", 313, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label4 = GUICtrlCreateLabel("Multiplikator", 443, 96, 89, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Ziffer = GUICtrlCreateLabel("1. Ziffer", 53, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label5 = GUICtrlCreateLabel("Widerstandsberechner", 80, 24, 280, 36)
    GUICtrlSetFont(-1, 20, 400, 0, "Arial")
    $Input1 = GUICtrlCreateInput("0,01", 443, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 11, 0)
    $Input2 = GUICtrlCreateInput("0", 313, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 9, 0)
    $Input3 = GUICtrlCreateInput("0", 183, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 9, 0)
    $Input4 = GUICtrlCreateInput("20", 573, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 7, 0)
    $Input5 = GUICtrlCreateInput("1", 53, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 12, 0)
    $Button1 = GUICtrlCreateButton("Schließen", 570, 265, 121, 30, 0)
    $Button2 = GUICtrlCreateButton("Copyright", 8, 272, 89, 25, 0)
    $Button3 = GUICtrlCreateButton("Rechnung (mit Toleranz)", 360, 224, 129, 41, 0)
    $Button4 = GUICtrlCreateButton("Rechnung (ohne Toleranz)", 200, 224, 137, 41, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    EndFunc
    $aboutitem = TrayCreateItem("Credits")
    TrayCreateItem("")
    $exititem = TrayCreateItem("Exit")
    TraySetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    Exit
    Case $Button2
    _credits()
    Case $Updown1
    GUICtrlSetData($Input6, $cLabel[GUICtrlRead($Blind_Input3)])
    GUICtrlSetData($Input5,$eLabel[GUICtrlRead($Blind_Input3)])
    Case $Updown2
    GUICtrlSetData($Input7, $aLabel[GUICtrlRead($Blind_Input4)])
    GUICtrlSetData($Input3,$fLabel[GUICtrlRead($Blind_Input4)])
    Case $Updown3
    GUICtrlSetData($Input8, $aLabel[GUICtrlRead($Blind_Input5)])
    GUICtrlSetData($Input2,$fLabel[GUICtrlRead($Blind_Input5)])
    Case $Updown4
    GUICtrlSetData($Input9, $dLabel[GUICtrlRead($Blind_Input6)])
    GUICtrlSetData($Input1,$gLabel[GUICtrlRead($Blind_Input6)])
    Case $Updown5
    GUICtrlSetData($Input10, $bLabel[GUICtrlRead($Blind_Input7)])
    GUICtrlSetData($Input4,$hLabel[GUICtrlRead($Blind_Input7)])
    EndSwitch
    $msg = TrayGetMsg()
    Select
    Case $msg = 0
    ContinueLoop
    Case $msg = $aboutitem
    Msgbox(64, "Credits", "Copyright (c)")
    Case $msg = $exititem
    ExitLoop
    EndSelect
    WEnd
    ;------------------------------------------------------------------------------------------------------------
    Func _intro ()
    #Region ### START Koda GUI section ### Form=
    $intro = GUICreate("Spotlight", 465, 303, -1, -1)
    GUICtrlCreatePic(@Scriptdir & "\Images\logo.jpg",-1,-1,465,303)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    Sleep(2500)
    GUIDelete()
    EndFunc

    [/autoit]


    MfG

  • Hallo Pinguin94,

    die Variablen müssen global definiert werden wenn sie nicht innerhalb einer einzigen Func benutzt werden sollen, daher musst du diese entweder Global definieren oder die Msg-Loop mit in die Func aufnehmen. Skript (2. Variante):

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Icon=images\icon.ico
    #AutoIt3Wrapper_Outfile=Widerstandsberechner.exe
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_UseAnsi=y
    #AutoIt3Wrapper_Res_LegalCopyright=xxx
    #AutoIt3Wrapper_Res_Language=1031
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <GDIPlus.au3>
    #include <EditConstants.au3>
    #include <ComboConstants.au3>
    #include <Constants.au3>
    Opt("TrayMenuMode", 1)
    Global $aLabel[10] = ['Schwarz', 'Braun', 'Rot', 'Orange', 'Gelb', 'Grün', 'Blau', 'Violett', 'Grau', 'Weiß']
    Global $bLabel[8] = ['Keine', 'Silber', 'Gold', 'Braun', 'Rot', 'Grün', 'Blau', 'Violett']
    Global $cLabel[9] = ['Braun', 'Rot', 'Orange', 'Gelb', 'Grün', 'Blau', 'Violett', 'Grau', 'Weiß']
    Global $dLabel[12] = ['Silber', 'Gold', 'Schwarz', 'Braun', 'Rot', 'Orange', 'Gelb', 'Grün', 'Blau', 'Violett', 'Grau', 'Weiß']

    [/autoit] [autoit][/autoit] [autoit]

    Global $eLabel[9] = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
    Global $fLabel[10] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
    Global $gLabel[12] = ['0,01', '0,1', '1', '10', '100', '1000', '10000', '100000', '1000000', '10000000', '100000000', '1000000000']
    Global $hLabel[8] = ['20', '10', '5', '1', '2', '0,5', '0,25', '0,1']
    ;Global $Button1, $Button2, $Button3, $Button4, $Updown1, $Updown2, $Updown3, $Updown4, $Updown5
    ;Global $Input1, $Input2, $Input3, $Input4, $Input5, $Input6, $Input7, $Input8, $Input9, $Input10
    ;Global $Blind_Input3, $Blind_Input4, $Blind_Input5, $Blind_Input6, $Blind_Input7
    ;------------------------------------------------------------------------------------------------------------
    TraySetIcon(@ScriptDir & "\Images\icon.ico")
    TrayTip("Copyright (c) 2009", "...", 2, 1)
    _intro()
    _gui()
    ;------------------------------------------------------------------------------------------------------------
    Func _gui()
    #Region ### START Koda GUI section ### Form=c:\users\rouven\desktop\form1.kxf
    $Form1 = GUICreate("Widerstandberechner", 700, 304, -1, -1, -1)
    GUISetBkColor(0xFDFDFD)
    $Ringanzahl = GUICtrlCreateLabel("Ringanzahl:", 446, 48, 89, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    GUICtrlCreateCombo("", 544, 45, 49, 5, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $WS_VSCROLL))
    GUICtrlSetFont(-1, 10, 400, 0, "arial")
    GUICtrlSetData(-1, " 4| 5", " 4")

    [/autoit] [autoit][/autoit] [autoit]

    $Input6 = GUICtrlCreateInput("", 40, 120, 97, 21, $ES_READONLY)
    $Blind_Input3 = GUICtrlCreateInput("", 153, 120, 1, 21)
    $Updown1 = GUICtrlCreateUpdown($Blind_Input3)
    GUICtrlSetLimit(-1, 8, 0)
    GUICtrlSetData($Input6, $cLabel[0])
    $Input7 = GUICtrlCreateInput("", 170, 120, 97, 21, $ES_READONLY)
    $Blind_Input4 = GUICtrlCreateInput("", 283, 120, 1, 21)
    $Updown2 = GUICtrlCreateUpdown($Blind_Input4)
    GUICtrlSetLimit(-1, 9, 0)
    GUICtrlSetData($Input7, $aLabel[0])
    $Input8 = GUICtrlCreateInput("", 300, 120, 97, 21, $ES_READONLY)
    $Blind_Input5 = GUICtrlCreateInput("", 413, 120, 1, 21)
    $Updown3 = GUICtrlCreateUpdown($Blind_Input5)
    GUICtrlSetLimit(-1, 9, 0)
    GUICtrlSetData($Input8, $aLabel[0])
    $Input9 = GUICtrlCreateInput("", 430, 120, 97, 21, $ES_READONLY)
    $Blind_Input6 = GUICtrlCreateInput("", 543, 120, 1, 21)
    $Updown4 = GUICtrlCreateUpdown($Blind_Input6)
    GUICtrlSetLimit(-1, 11, 0)
    GUICtrlSetData($Input9, $dLabel[0])
    $Input10 = GUICtrlCreateInput("", 560, 120, 97, 21, $ES_READONLY)
    $Blind_Input7 = GUICtrlCreateInput("", 673, 120, 1, 21)
    $Updown5 = GUICtrlCreateUpdown($Blind_Input7)
    GUICtrlSetLimit(-1, 7, 0)
    GUICtrlSetData($Input10, $bLabel[0])

    [/autoit] [autoit][/autoit] [autoit]

    $Label1 = GUICtrlCreateLabel("Toleranz", 573, 96, 66, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label2 = GUICtrlCreateLabel("2. Ziffer", 183, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label3 = GUICtrlCreateLabel("3. Ziffer", 313, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label4 = GUICtrlCreateLabel("Multiplikator", 443, 96, 89, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Ziffer = GUICtrlCreateLabel("1. Ziffer", 53, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label5 = GUICtrlCreateLabel("Widerstandsberechner", 80, 24, 280, 36)
    GUICtrlSetFont(-1, 20, 400, 0, "Arial")
    $Input1 = GUICtrlCreateInput("0,01", 443, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 11, 0)
    $Input2 = GUICtrlCreateInput("0", 313, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 9, 0)
    $Input3 = GUICtrlCreateInput("0", 183, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 9, 0)
    $Input4 = GUICtrlCreateInput("20", 573, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 7, 0)
    $Input5 = GUICtrlCreateInput("1", 53, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 12, 0)
    $Button1 = GUICtrlCreateButton("Schließen", 570, 265, 121, 30, 0)
    $Button2 = GUICtrlCreateButton("Copyright", 8, 272, 89, 25, 0)
    $Button3 = GUICtrlCreateButton("Rechnung (mit Toleranz)", 360, 224, 129, 41, 0)
    $Button4 = GUICtrlCreateButton("Rechnung (ohne Toleranz)", 200, 224, 137, 41, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $aboutitem = TrayCreateItem("Credits")
    TrayCreateItem("")
    $exititem = TrayCreateItem("Exit")
    TraySetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    Exit
    Case $Button2
    _credits()
    Case $Updown1
    GUICtrlSetData($Input6, $cLabel[GUICtrlRead($Blind_Input3)])
    GUICtrlSetData($Input5, $eLabel[GUICtrlRead($Blind_Input3)])
    Case $Updown2
    GUICtrlSetData($Input7, $aLabel[GUICtrlRead($Blind_Input4)])
    GUICtrlSetData($Input3, $fLabel[GUICtrlRead($Blind_Input4)])
    Case $Updown3
    GUICtrlSetData($Input8, $aLabel[GUICtrlRead($Blind_Input5)])
    GUICtrlSetData($Input2, $fLabel[GUICtrlRead($Blind_Input5)])
    Case $Updown4
    GUICtrlSetData($Input9, $dLabel[GUICtrlRead($Blind_Input6)])
    GUICtrlSetData($Input1, $gLabel[GUICtrlRead($Blind_Input6)])
    Case $Updown5
    GUICtrlSetData($Input10, $bLabel[GUICtrlRead($Blind_Input7)])
    GUICtrlSetData($Input4, $hLabel[GUICtrlRead($Blind_Input7)])
    EndSwitch
    $msg = TrayGetMsg()
    Select
    Case $msg = 0
    ContinueLoop
    Case $msg = $aboutitem
    MsgBox(64, "Credits", "Copyright (c)")
    Case $msg = $exititem
    ExitLoop
    EndSelect
    WEnd
    EndFunc ;==>_gui so müssen die Variablen nicht global definiert werden
    ;------------------------------------------------------------------------------------------------------------
    Func _intro()
    #Region ### START Koda GUI section ### Form=
    $intro = GUICreate("Spotlight", 465, 303, -1, -1)
    GUICtrlCreatePic(@ScriptDir & "\Images\logo.jpg", -1, -1, 465, 303)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    Sleep(2500)
    GUIDelete()
    EndFunc ;==>_intro
    ;------------------------------------------------------------------------------------------------------------
    Func _credits()
    MsgBox(0, "Credits to", "")
    EndFunc ;==>_credits

    [/autoit]

    mfg (Auto)Bert

  • Um nicht zusätzlich einen neuen Thread zu eröffnen, wollte ich einfach mal fragen, warum er nicht die Werte aus den Inputboxen richtig addiert und multipliziert?

    Und wie bekomm ich es hin, dass er sie immer wieder aktualisiert, also wenn ich eine andere Farbe einstelle, ändert sich ja auch der Wert in der Inputbox und der soll direkt addiert werden. Ich habe es schon mit AdlibEnable versucht, wollte aber nicht so recht gelingen.


    Hier das Script:


    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_icon=images\icon.ico
    #AutoIt3Wrapper_outfile=Widerstandsberechner.exe
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_UseAnsi=y
    #AutoIt3Wrapper_Res_LegalCopyright=xxx
    #AutoIt3Wrapper_Res_Language=1031
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <GDIPlus.au3>
    #include <EditConstants.au3>
    #include <ComboConstants.au3>
    #Include <Constants.au3>
    Opt("TrayMenuMode",1)
    Global $aLabel[10] = ['Schwarz','Braun','Rot','Orange','Gelb','Grün','Blau','Violett','Grau','Weiß']
    Global $bLabel[8] = ['Keine', 'Silber', 'Gold','Braun','Rot','Grün','Blau','Violett']
    Global $cLabel[9] = ['Braun','Rot','Orange','Gelb','Grün','Blau','Violett','Grau','Weiß']
    Global $dLabel[12] = ['Silber', 'Gold', 'Schwarz','Braun','Rot','Orange','Gelb','Grün','Blau','Violett','Grau','Weiß']

    [/autoit] [autoit][/autoit] [autoit]

    Global $eLabel[9] = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
    Global $fLabel [10] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
    Global $gLabel [12] = ['0,01', '0,1', '1', '10', '100', '1000', '10000', '100000', '1000000', '10000000', '100000000', '1000000000']
    Global $hLabel [8] = ['20', '10', '5', '1', '2', '0,5', '0,25', '0,1']
    Global $Button1, $Button2, $Updown1, $Updown2, $Updown3, $Updown4, $Updown5
    Global $Combo1, $oTol, $mTol, $oTol2, $mTol2
    AdlibEnable("_rechnen",50)
    ;------------------------------------------------------------------------------------------------------------
    TraySetIcon(@Scriptdir & "\Images\icon.ico")
    TrayTip("Copyright (c) 2009","xxx",2,1)
    _intro()
    ;------------------------------------------------------------------------------------------------------------
    #Region ### START Koda GUI section ###
    $Form1 = GUICreate("Widerstandberechner", 700, 304, -1, -1,-1)
    GUISetBkColor(0xAAE3FF)
    $Ringanzahl = GUICtrlCreateLabel("Ringanzahl:", 446, 48, 89, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Combo1 = GUICtrlCreateCombo("", 544, 45, 49, 5, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$WS_VSCROLL))
    GUICtrlSetFont(-1, 10, 400, 0, "arial")
    GUICtrlSetData(-1, " 4| 5", " 4")

    [/autoit] [autoit][/autoit] [autoit]

    $Input6 = GUICtrlCreateInput("", 40, 120, 97, 21, $ES_READONLY)
    $Blind_Input3 = GUICtrlCreateInput("",153,120,1,21)
    $Updown1 = GUICtrlCreateUpdown($Blind_Input3)
    GUICtrlSetLimit(-1, 8, 0)
    GUICtrlSetData($Input6, $cLabel[0])
    $Input7 = GUICtrlCreateInput("", 170, 120, 97, 21, $ES_READONLY)
    $Blind_Input4 = GUICtrlCreateInput("",283, 120, 1, 21)
    $Updown2 = GUICtrlCreateUpdown($Blind_Input4)
    GUICtrlSetLimit(-1, 9, 0)
    GUICtrlSetData($Input7, $aLabel[0])
    $Input8 = GUICtrlCreateInput("", 300, 120, 97, 21, $ES_READONLY)
    $Blind_Input5 = GUICtrlCreateInput("", 413, 120, 1, 21)
    $Updown3 = GUICtrlCreateUpdown($Blind_Input5)
    GUICtrlSetLimit(-1, 9, 0)
    GUICtrlSetData($Input8, $aLabel[0])
    $Input9 = GUICtrlCreateInput("", 430, 120, 97, 21, $ES_READONLY)
    $Blind_Input6 = GUICtrlCreateInput("", 543, 120, 1, 21)
    $Updown4 = GUICtrlCreateUpdown($Blind_Input6)
    GUICtrlSetLimit(-1, 11, 0)
    GUICtrlSetData($Input9, $dLabel[0])
    $Input10 = GUICtrlCreateInput("", 560, 120, 97, 21, $ES_READONLY)
    $Blind_Input7 = GUICtrlCreateInput("", 673, 120, 1, 21)
    $Updown5 = GUICtrlCreateUpdown($Blind_Input7)
    GUICtrlSetLimit(-1, 7, 0)
    GUICtrlSetData($Input10, $bLabel[0])

    $Label1 = GUICtrlCreateLabel("Toleranz", 573, 96, 66, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label2 = GUICtrlCreateLabel("2. Ziffer", 183, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label3 = GUICtrlCreateLabel("3. Ziffer", 313, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label4 = GUICtrlCreateLabel("Multiplikator", 443, 96, 89, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Ziffer = GUICtrlCreateLabel("1. Ziffer", 53, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label5 = GUICtrlCreateLabel("Widerstandsberechner", 80, 24, 280, 36)
    GUICtrlSetFont(-1, 20, 400, 0, "Arial")
    $Input1 = GUICtrlCreateInput("0,01", 443, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 11, 0)
    $Input2 = GUICtrlCreateInput("0", 313, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 9, 0)
    $Input3 = GUICtrlCreateInput("0", 183, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 9, 0)
    $Input4 = GUICtrlCreateInput("20", 573, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 7, 0)
    $Input5 = GUICtrlCreateInput("1", 53, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 12, 0)
    $Button1 = GUICtrlCreateButton("Schließen", 570, 265, 121, 30, 0)
    $Button2 = GUICtrlCreateButton("Copyright", 8, 272, 89, 25, 0)
    $Label6 = GUICtrlCreateLabel("Lösung ohne Toleranz:", 175, 217, 300, 25)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Input11 = GUICtrlCreateInput("", 350, 215, 150, 25, $ES_READONLY)
    $Label7 = GUICtrlCreateLabel("Lösung mit Toleranz:", 175, 257, 300, 25)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Input12 = GUICtrlCreateInput("", 350, 255, 150, 25, $ES_READONLY)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $aboutitem = TrayCreateItem("Credits")
    TrayCreateItem("")
    $exititem = TrayCreateItem("Exit")
    TraySetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    Exit
    Case $Button2
    _credits()
    Case $Updown1
    GUICtrlSetData($Input6, $cLabel[GUICtrlRead($Blind_Input3)])
    GUICtrlSetData($Input5,$eLabel[GUICtrlRead($Blind_Input3)])
    Case $Updown2
    GUICtrlSetData($Input7, $aLabel[GUICtrlRead($Blind_Input4)])
    GUICtrlSetData($Input3,$fLabel[GUICtrlRead($Blind_Input4)])
    Case $Updown3
    GUICtrlSetData($Input8, $aLabel[GUICtrlRead($Blind_Input5)])
    GUICtrlSetData($Input2,$fLabel[GUICtrlRead($Blind_Input5)])
    Case $Updown4
    GUICtrlSetData($Input9, $dLabel[GUICtrlRead($Blind_Input6)])
    GUICtrlSetData($Input1,$gLabel[GUICtrlRead($Blind_Input6)])
    Case $Updown5
    GUICtrlSetData($Input10, $bLabel[GUICtrlRead($Blind_Input7)])
    GUICtrlSetData($Input4,$hLabel[GUICtrlRead($Blind_Input7)])
    EndSwitch
    _rechnen()
    $msg = TrayGetMsg()
    Select
    Case $msg = 0
    ContinueLoop
    Case $msg = $aboutitem
    Msgbox(64, "Credits", "xxx")
    Case $msg = $exititem
    ExitLoop
    EndSelect
    WEnd
    ;------------------------------------------------------------------------------------------------------------
    Func _intro ()
    #Region ### START Koda GUI section ### Form=
    $intro = GUICreate("Spotlight", 465, 303, -1, -1)
    GUICtrlCreatePic(@Scriptdir & "\Images\logo.jpg",-1,-1,465,303)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    Sleep(2500)
    GUIDelete()
    EndFunc
    ;------------------------------------------------------------------------------------------------------------
    Func _rechnen()
    If $Combo1 = 4 Then
    $oTol = Execute(($Input5*10+$Input3*1)*$Input1)
    $mTol = Execute((($Input5*10+$Input3*1)*$Input1)+100/$Input4)
    GUICtrlSetData($Input11, $oTol)
    GUICtrlSetData($Input12, $mTol)
    EndIf
    If $Combo1 = 5 Then
    $oTol2 = Execute(($Input5*100+$Input3*10+$Input2*1)*$Input1)
    $mTol2 = Execute((($Input5*100+$Input3*10+$Input2*1)*$Input1)+100/$Input4)
    GUICtrlSetData($Input11, $oTol2)
    GUICtrlSetData($Input12, $mTol2)
    EndIf
    EndFunc

    [/autoit]


    Danke schonmal :)

  • Ich weiß zwar nicht ob dann rauskommt was rauskommen soll aber probiers mal so:

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_icon=images\icon.ico
    #AutoIt3Wrapper_outfile=Widerstandsberechner.exe
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_UseAnsi=y
    #AutoIt3Wrapper_Res_LegalCopyright=xxx
    #AutoIt3Wrapper_Res_Language=1031
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <GDIPlus.au3>
    #include <EditConstants.au3>
    #include <ComboConstants.au3>
    #Include <Constants.au3>
    Opt("TrayMenuMode",1)
    Global $aLabel[10] = ['Schwarz','Braun','Rot','Orange','Gelb','Grün','Blau','Violett','Grau','Weiß']
    Global $bLabel[8] = ['Keine', 'Silber', 'Gold','Braun','Rot','Grün','Blau','Violett']
    Global $cLabel[9] = ['Braun','Rot','Orange','Gelb','Grün','Blau','Violett','Grau','Weiß']
    Global $dLabel[12] = ['Silber', 'Gold', 'Schwarz','Braun','Rot','Orange','Gelb','Grün','Blau','Violett','Grau','Weiß']

    [/autoit] [autoit][/autoit] [autoit]

    Global $eLabel[9] = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
    Global $fLabel [10] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
    Global $gLabel [12] = ['0,01', '0,1', '1', '10', '100', '1000', '10000', '100000', '1000000', '10000000', '100000000', '1000000000']
    Global $hLabel [8] = ['20', '10', '5', '1', '2', '0,5', '0,25', '0,1']
    Global $Button1, $Button2, $Updown1, $Updown2, $Updown3, $Updown4, $Updown5
    Global $Combo1, $oTol, $mTol, $oTol2, $mTol2
    ;------------------------------------------------------------------------------------------------------------
    TraySetIcon(@Scriptdir & "\Images\icon.ico")
    TrayTip("Copyright (c) 2009","xxx",2,1)
    _intro()
    ;------------------------------------------------------------------------------------------------------------
    #Region ### START Koda GUI section ###
    $Form1 = GUICreate("Widerstandberechner", 700, 304, -1, -1,-1)
    GUISetBkColor(0xAAE3FF)
    $Ringanzahl = GUICtrlCreateLabel("Ringanzahl:", 446, 48, 89, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Combo1 = GUICtrlCreateCombo("", 544, 45, 49, 5, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$WS_VSCROLL))
    GUICtrlSetFont(-1, 10, 400, 0, "arial")
    GUICtrlSetData(-1, " 4| 5", " 4")

    [/autoit] [autoit][/autoit] [autoit]

    $Input6 = GUICtrlCreateInput("", 40, 120, 97, 21, $ES_READONLY)
    $Blind_Input3 = GUICtrlCreateInput("",153,120,1,21)
    $Updown1 = GUICtrlCreateUpdown($Blind_Input3)
    GUICtrlSetLimit(-1, 8, 0)
    GUICtrlSetData($Input6, $cLabel[0])
    $Input7 = GUICtrlCreateInput("", 170, 120, 97, 21, $ES_READONLY)
    $Blind_Input4 = GUICtrlCreateInput("",283, 120, 1, 21)
    $Updown2 = GUICtrlCreateUpdown($Blind_Input4)
    GUICtrlSetLimit(-1, 9, 0)
    GUICtrlSetData($Input7, $aLabel[0])
    $Input8 = GUICtrlCreateInput("", 300, 120, 97, 21, $ES_READONLY)
    $Blind_Input5 = GUICtrlCreateInput("", 413, 120, 1, 21)
    $Updown3 = GUICtrlCreateUpdown($Blind_Input5)
    GUICtrlSetLimit(-1, 9, 0)
    GUICtrlSetData($Input8, $aLabel[0])
    $Input9 = GUICtrlCreateInput("", 430, 120, 97, 21, $ES_READONLY)
    $Blind_Input6 = GUICtrlCreateInput("", 543, 120, 1, 21)
    $Updown4 = GUICtrlCreateUpdown($Blind_Input6)
    GUICtrlSetLimit(-1, 11, 0)
    GUICtrlSetData($Input9, $dLabel[0])
    $Input10 = GUICtrlCreateInput("", 560, 120, 97, 21, $ES_READONLY)
    $Blind_Input7 = GUICtrlCreateInput("", 673, 120, 1, 21)
    $Updown5 = GUICtrlCreateUpdown($Blind_Input7)
    GUICtrlSetLimit(-1, 7, 0)
    GUICtrlSetData($Input10, $bLabel[0])

    $Label1 = GUICtrlCreateLabel("Toleranz", 573, 96, 66, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label2 = GUICtrlCreateLabel("2. Ziffer", 183, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label3 = GUICtrlCreateLabel("3. Ziffer", 313, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label4 = GUICtrlCreateLabel("Multiplikator", 443, 96, 89, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Ziffer = GUICtrlCreateLabel("1. Ziffer", 53, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label5 = GUICtrlCreateLabel("Widerstandsberechner", 80, 24, 280, 36)
    GUICtrlSetFont(-1, 20, 400, 0, "Arial")
    $Input1 = GUICtrlCreateInput("0,01", 443, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 11, 0)
    $Input2 = GUICtrlCreateInput("0", 313, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 9, 0)
    $Input3 = GUICtrlCreateInput("0", 183, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 9, 0)
    $Input4 = GUICtrlCreateInput("20", 573, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 7, 0)
    $Input5 = GUICtrlCreateInput("1", 53, 168, 81, 21, $ES_READONLY)
    GUICtrlSetLimit(-1, 12, 0)
    $Button1 = GUICtrlCreateButton("Schließen", 570, 265, 121, 30, 0)
    $Button2 = GUICtrlCreateButton("Copyright", 8, 272, 89, 25, 0)
    $Label6 = GUICtrlCreateLabel("Lösung ohne Toleranz:", 175, 217, 300, 25)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Input11 = GUICtrlCreateInput("", 350, 215, 150, 25, $ES_READONLY)
    $Label7 = GUICtrlCreateLabel("Lösung mit Toleranz:", 175, 257, 300, 25)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Input12 = GUICtrlCreateInput("", 350, 255, 150, 25, $ES_READONLY)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $aboutitem = TrayCreateItem("Credits")
    TrayCreateItem("")
    $exititem = TrayCreateItem("Exit")
    TraySetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    Exit
    Case $Button2
    _credits()
    Case $Updown1
    GUICtrlSetData($Input6, $cLabel[GUICtrlRead($Blind_Input3)])
    GUICtrlSetData($Input5,$eLabel[GUICtrlRead($Blind_Input3)])
    _rechnen()
    Case $Updown2
    GUICtrlSetData($Input7, $aLabel[GUICtrlRead($Blind_Input4)])
    GUICtrlSetData($Input3,$fLabel[GUICtrlRead($Blind_Input4)])
    _rechnen()
    Case $Updown3
    GUICtrlSetData($Input8, $aLabel[GUICtrlRead($Blind_Input5)])
    GUICtrlSetData($Input2,$fLabel[GUICtrlRead($Blind_Input5)])
    _rechnen()
    Case $Updown4
    GUICtrlSetData($Input9, $dLabel[GUICtrlRead($Blind_Input6)])
    GUICtrlSetData($Input1,$gLabel[GUICtrlRead($Blind_Input6)])
    _rechnen()
    Case $Updown5
    GUICtrlSetData($Input10, $bLabel[GUICtrlRead($Blind_Input7)])
    GUICtrlSetData($Input4,$hLabel[GUICtrlRead($Blind_Input7)])
    _rechnen()
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    $msg = TrayGetMsg()
    Select
    Case $msg = 0
    ContinueLoop
    Case $msg = $aboutitem
    Msgbox(64, "Credits", "xxx")
    Case $msg = $exititem
    ExitLoop
    EndSelect
    WEnd
    ;------------------------------------------------------------------------------------------------------------
    Func _intro ()
    #Region ### START Koda GUI section ### Form=
    $intro = GUICreate("Spotlight", 465, 303, -1, -1)
    GUICtrlCreatePic(@Scriptdir & "\Images\logo.jpg",-1,-1,465,303)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    Sleep(2500)
    GUIDelete()
    EndFunc
    ;------------------------------------------------------------------------------------------------------------
    Func _rechnen()
    If $Combo1 = 4 Then
    $oTol = Execute((GUICtrlRead($Input5)*10+GUICtrlRead($Input3)*1)*GUICtrlRead($Input1))
    $mTol = Execute(((GUICtrlRead($Input5)*10+GUICtrlRead($Input3)*1)*GUICtrlRead($Input1))+100/GUICtrlRead($Input4))
    GUICtrlSetData($Input11, $oTol)
    GUICtrlSetData($Input12, $mTol)
    EndIf
    If $Combo1 = 5 Then
    $oTol2 = Execute((GUICtrlRead($Input5)*100+GUICtrlRead($Input3)*10+GUICtrlRead($Input2)*1)*GUICtrlRead($Input1))
    $mTol2 = Execute(((GUICtrlRead($Input5)*100+GUICtrlRead($Input3)*10+GUICtrlRead($Input2)*1)*GUICtrlRead($Input1))+100/GUICtrlRead($Input4))
    GUICtrlSetData($Input11, $oTol2)
    GUICtrlSetData($Input12, $mTol2)
    EndIf
    EndFunc
    ;------------------------------------------------------------------------------------------------------------
    Func _credits()
    TrayTip("...","...",1)
    EndFunc

    [/autoit]

    Was ich gemacht habe:
    - Adlibenable entfernt.
    - funktion _rechnen() ausgebessert - habe die ganzen Variablen (die ja control-ID's darstellten) durch GUICtrlRead()'s ersetzt.
    ein _rechnen() unter jedes Case in der While schleife ^^

    Ich hoffe es funktioniert wie du es willst.

    PS: irgendwie fehlt bei dir immer die _credits funktion also habe ich da mal eine Dummy funktion engesetzt.

    • Offizieller Beitrag

    Ich habe mal noch gekürzt, um zu zeigen, was du mit Arrays einsparen kannst. ;)
    In deine 'Rechnen'-Funktion mußt du noch eine Fehlerbehandlung einbauen bzw. die Ausgabe je nach Ergebnis in kOhm oder MOhm machen. Du bekommst sonst nicht anzeigbare Ergebnisse.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <GDIPlus.au3>
    #include <EditConstants.au3>
    #include <ComboConstants.au3>
    #Include <Constants.au3>
    Opt("TrayMenuMode",1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $arLabel[12][5] = [ _
    ['Braun','Schwarz','Schwarz','Silber','Keine'], _
    ['Rot','Braun','Braun','Gold','Silber'], _
    ['Orange','Rot','Rot','Schwarz','Gold'], _
    ['Gelb','Orange','Orange','Braun','Braun'], _
    ['Grün','Gelb','Gelb','Rot','Rot'], _
    ['Blau','Grün','Grün','Orange','Grün'], _
    ['Violett','Blau','Blau','Gelb','Blau'], _
    ['Grau','Violett','Violett','Grün','Violett'], _
    ['Weiß','Grau','Grau','Blau',''], _
    ['','Weiß','Weiß','Violett',''], _
    ['','','','Grau',''], _
    ['','','','Weiß','']]

    [/autoit] [autoit][/autoit] [autoit]

    Global $arValue[12][5] = [ _
    ['1','0','0','0,01','20'], _
    ['2','1','1','0,1','10'], _
    ['3','2','2','1','5'], _
    ['4','3','3','10','1'], _
    ['5','4','4','100','2'], _
    ['6','5','5','1000','0,5'], _
    ['7','6','6','10000','0,25'], _
    ['8','7','7','100000','0,1'], _
    ['9','8','8','1000000',''], _
    ['','9','9','10000000',''], _
    ['','','','100000000',''], _
    ['','','','1000000000','']]

    [/autoit] [autoit][/autoit] [autoit]

    Global $Button1, $Button2, $Combo1, $oTol, $mTol
    Global $aInput[5][3], $aInput2[5]

    [/autoit] [autoit][/autoit] [autoit]

    ;------------------------------------------------------------------------------------------------------------
    TraySetIcon(@Scriptdir & "\Images\icon.ico")
    TrayTip("Copyright (c) 2009","xxx",2,1)
    ;~ _intro()
    ;------------------------------------------------------------------------------------------------------------
    $Form1 = GUICreate("Widerstandberechner", 700, 304, -1, -1,-1)
    GUISetBkColor(0xAAE3FF)
    $Ringanzahl = GUICtrlCreateLabel("Ringanzahl:", 446, 48, 89, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Combo1 = GUICtrlCreateCombo("", 544, 45, 49, 5, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$WS_VSCROLL))
    GUICtrlSetFont(-1, 10, 400, 0, "arial")
    GUICtrlSetData(-1, " 4| 5", " 4")

    [/autoit] [autoit][/autoit] [autoit]

    Local $x1 = 40, $x2 = 153, $limit = StringSplit('8;9;9;11;7', ';', 2)
    For $i = 0 To 4
    $aInput[$i][0] = GUICtrlCreateInput("", $x1, 120, 97, 21, $ES_READONLY) ; Input
    $aInput[$i][1] = GUICtrlCreateInput("", $x2, 120, 1, 21) ; Blind-Input
    $aInput[$i][2] = GUICtrlCreateUpdown($aInput[$i][1]) ; UpDown
    GUICtrlSetLimit($aInput[$i][2], $limit[$i], 0)
    GUICtrlSetData($aInput[$i][0], $arLabel[0][$i])
    $x1 += 130
    $x2 += 130
    Next

    [/autoit] [autoit][/autoit] [autoit]

    $Ziffer = GUICtrlCreateLabel("1. Ziffer", 53, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label2 = GUICtrlCreateLabel("2. Ziffer", 183, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label3 = GUICtrlCreateLabel("3. Ziffer", 313, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label1 = GUICtrlCreateLabel("Toleranz", 573, 96, 66, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label4 = GUICtrlCreateLabel("Multiplikator", 443, 96, 89, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label5 = GUICtrlCreateLabel("Widerstandsberechner", 80, 24, 280, 36)
    GUICtrlSetFont(-1, 20, 400, 0, "Arial")

    [/autoit] [autoit][/autoit] [autoit]

    $x = 53
    $sText = StringSplit('1;0;0;0,01;20', ';', 2)
    $limit = StringSplit('12;9;9;11;7', ';', 2)
    For $i = 0 To 4
    $aInput2[$i] = GUICtrlCreateInput($sText[$i], $x, 168, 81, 21, BitOR($ES_READONLY,$ES_RIGHT))
    GUICtrlSetLimit($aInput2[$i], $limit[$i], 0)
    $x += 130
    Next

    [/autoit] [autoit][/autoit] [autoit]

    $Button1 = GUICtrlCreateButton("Schließen", 570, 265, 121, 30, 0)
    $Button2 = GUICtrlCreateButton("Copyright", 8, 272, 89, 25, 0)
    $Label6 = GUICtrlCreateLabel("Lösung ohne Toleranz:", 175, 217, 300, 25)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Input11 = GUICtrlCreateInput("", 350, 215, 150, 25, $ES_READONLY)
    $Label7 = GUICtrlCreateLabel("Lösung mit Toleranz:", 175, 257, 300, 25)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Input12 = GUICtrlCreateInput("", 350, 255, 150, 25, $ES_READONLY)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)
    $aboutitem = TrayCreateItem("Credits")
    TrayCreateItem("")
    $exititem = TrayCreateItem("Exit")
    TraySetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button1, $GUI_EVENT_CLOSE
    Exit
    Case $Combo1
    _Rechnen()
    Case $Button2
    ;~ _credits()
    EndSwitch
    For $i = 0 To 4 ; UpDowns checken
    If $nMsg = $aInput[$i][2] Then
    GUICtrlSetData($aInput[$i][0], $arLabel[GUICtrlRead($aInput[$i][1])][$i])
    GUICtrlSetData($aInput2[$i], $arValue[GUICtrlRead($aInput[$i][1])][$i])
    _Rechnen()
    EndIf
    Next
    $msg = TrayGetMsg()
    Select
    Case $msg = 0
    ContinueLoop
    Case $msg = $aboutitem
    Msgbox(64, "Credits", "xxx")
    Case $msg = $exititem
    ExitLoop
    EndSelect
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    ;------------------------------------------------------------------------------------------------------------
    Func _intro ()
    $intro = GUICreate("Spotlight", 465, 303, -1, -1)
    GUICtrlCreatePic(@Scriptdir & "\Images\logo.jpg",-1,-1,465,303)
    GUISetState(@SW_SHOW)
    Sleep(2500)
    GUIDelete()
    EndFunc
    ;------------------------------------------------------------------------------------------------------------
    Func _Rechnen()
    Switch GUICtrlRead($Combo1)
    Case 4
    $oTol = (GUICtrlRead($aInput2[0])*10 + GUICtrlRead($aInput2[1]))*GUICtrlRead($aInput2[3])
    Case Else
    $oTol = (GUICtrlRead($aInput2[0])*100 + GUICtrlRead($aInput2[1])*10 + GUICtrlRead($aInput2[2]))*GUICtrlRead($aInput2[3])
    EndSwitch
    $mTol = ($oTol +100)/GUICtrlRead($aInput2[4])
    GUICtrlSetData($Input11, $oTol)
    GUICtrlSetData($Input12, $mTol)
    EndFunc

    [/autoit]

    Evtl. sind noch paar Fehlerchen drin, hab jetzt nicht alles getestet, eher als Anregung gedacht.

  • Leider Funktioniert das mit dem Rechnen noch nicht so ganz :S

    Bei 4 Ringen muss man die 1.Ziffer x 10 und die 2.Ziffer x 1 rechnen mal dem Multiplikator.

    Bei 5 Ringen muss man die 1.Ziffer x 100, die 2. Ziffer x 10 und die 3. Ziffer x1 mal dem Multiplikator nehmen.

    Und halt jeweils die Toleranz mit einberechnen.

    Nur zeigt er momentan falsche Ergebnisse an.

    Ich dachte, dass man es ganz einfach lösen kann, wenn man die Werte in den InputBoxen hat, die ausliest und richtig zusammenaddiert.

    Anscheinend funktioniert das nicht so ganz.


    Die Credits Funktion hab ich rausgenommen, da ich Bruchstücke aus diesem Forum einfach reinkopiert habe, und halt Text passend geändert hatte.

    Ich wusste nicht wie ich das Hand haben soll. Ob ich das nun einfach drin lassen darf, oder halt nicht. Kann ja sein, dass irgendwer Ansprüche aufstellt :D


    MfG Pingu


    EDIT: Danke @ BugFix, nur leider funktioniert das rechnen immer noch nicht so ganz gut :S Aber ich hatte mir schon gedacht, dass man mit 2 Dimensionalen Arrays arbeiten kann, wusste nur nicht wie ich das verwirkliche.

    • Offizieller Beitrag

    Hatte ich gar nicht drauf geachtet - du verwendest ',' als Dezimaltrenner. Das muß man beim Rechnen dann natürlich ändern. Ich korrigiere das gleich mal und editiere dann diesen Post hier.


    Edit:
    Ersetze bitte die Funktion _Rechnen() mit der nachfolgenden und ergänze um die Funktion _Switch().

    Spoiler anzeigen
    [autoit]

    Func _Rechnen()
    Switch GUICtrlRead($Combo1)
    Case 4
    $oTol = (_Switch(GUICtrlRead($aInput2[0]))*10 + _Switch(GUICtrlRead($aInput2[1])))*_Switch(GUICtrlRead($aInput2[3]))
    Case Else
    $oTol = (_Switch(GUICtrlRead($aInput2[0]))*100 + _Switch(GUICtrlRead($aInput2[1]))*10 + _Switch(GUICtrlRead($aInput2[2])))*_Switch(GUICtrlRead($aInput2[3]))
    EndSwitch
    $mTol = ($oTol +100)/GUICtrlRead($aInput2[4])
    GUICtrlSetData($Input11, _Switch($oTol, 0))
    GUICtrlSetData($Input12, _Switch($mTol, 0))
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Switch($str, $pt=1)
    If $pt Then
    Return Number(StringReplace(String($str), ',', '.'))
    Else
    Return String(StringReplace(String($str), '.', ','))
    EndIf
    EndFunc

    [/autoit]
  • Danke, funktioniert nun.

    Musste halt nur noch die Rechnung mit der Toleranz ein wenig anpassen, aber im Großen und Ganze schöne Arbeit :)

    Danke


    EDIT: Allerletzte Frage:

    Warum macht er einen Error in Line -1! wenn ich das Script compiled hab, obwohl es als .au3 funktioniert?

    Ich lass es mit Options compilen um ein anderes Icon etc zu haben, jedoch macht er einen Error in Line -1 mit der Begründung:

    Array variable has incorrect number of subscropts or subscript dimension range exceeded.


    Danke euch nochmal, wenn ihr diese letzte Frage beantwortet habt, hab schon genug Fragen gestellt x)

    • Offizieller Beitrag

    Wenn ich das script aus beiden Post´s von BugFix Compiliere kommt bei mir kein Fehler.
    Stell mal deine kompletten Source hier ein, mal schauen ob dort ein Fehler enthalten ist.

  • Hier der Source:


    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_icon=images\icon.ico
    #AutoIt3Wrapper_outfile=Widerstandsberechner.exe
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_UseAnsi=y
    #AutoIt3Wrapper_Res_LegalCopyright=xxx
    #AutoIt3Wrapper_Res_Language=1031
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <GDIPlus.au3>
    #include <EditConstants.au3>
    #include <ComboConstants.au3>
    #Include <Constants.au3>
    Opt("TrayMenuMode",1)
    Global $arLabel[12][5] = [ _
    ['Braun','Schwarz','Schwarz','Silber','Keine'], _
    ['Rot','Braun','Braun','Gold','Silber'], _
    ['Orange','Rot','Rot','Schwarz','Gold'], _
    ['Gelb','Orange','Orange','Braun','Braun'], _
    ['Grün','Gelb','Gelb','Rot','Rot'], _
    ['Blau','Grün','Grün','Orange','Grün'], _
    ['Violett','Blau','Blau','Gelb','Blau'], _
    ['Grau','Violett','Violett','Grün','Violett'], _
    ['Weiß','Grau','Grau','Blau',''], _
    ['','Weiß','Weiß','Violett',''], _
    ['','','','Grau',''], _
    ['','','','Weiß','']]
    Global $arValue[12][5] = [ _
    ['1','0','0','0,01','20'], _
    ['2','1','1','0,1','10'], _
    ['3','2','2','1','5'], _
    ['4','3','3','10','1'], _
    ['5','4','4','100','2'], _
    ['6','5','5','1000','0,5'], _
    ['7','6','6','10000','0,25'], _
    ['8','7','7','100000','0,1'], _
    ['9','8','8','1000000',''], _
    ['','9','9','10000000',''], _
    ['','','','100000000',''], _
    ['','','','1000000000','']]
    Global $Button1, $Button2, $Combo1, $oTol, $mTol, $Tol
    Global $aInput[5][3], $aInput2[5]
    ;------------------------------------------------------------------------------------------------------------
    TraySetIcon(@Scriptdir & "\Images\icon.ico")
    TrayTip("Copyright (c) 2009","xxx",2,1)
    _intro()
    ;------------------------------------------------------------------------------------------------------------
    $Form1 = GUICreate("Widerstandberechner", 700, 304, -1, -1,-1)
    GUISetBkColor(0xAAE3FF)
    $Ringanzahl = GUICtrlCreateLabel("Ringanzahl:", 446, 48, 89, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Combo1 = GUICtrlCreateCombo("", 544, 45, 49, 5, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$WS_VSCROLL))
    GUICtrlSetFont(-1, 10, 400, 0, "arial")
    GUICtrlSetData(-1, " 4| 5", " 4")
    Local $x1 = 40, $x2 = 153, $limit = StringSplit('8;9;9;11;7', ';', 2)
    For $i = 0 To 4
    $aInput[$i][0] = GUICtrlCreateInput("", $x1, 120, 97, 21, $ES_READONLY) ; Input
    $aInput[$i][1] = GUICtrlCreateInput("", $x2, 120, 1, 21) ; Blind-Input
    $aInput[$i][2] = GUICtrlCreateUpdown($aInput[$i][1]) ; UpDown
    GUICtrlSetLimit($aInput[$i][2], $limit[$i], 0)
    GUICtrlSetData($aInput[$i][0], $arLabel[0][$i])
    $x1 += 130
    $x2 += 130
    Next
    $Ziffer = GUICtrlCreateLabel("1. Ziffer", 53, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label2 = GUICtrlCreateLabel("2. Ziffer", 183, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label3 = GUICtrlCreateLabel("3. Ziffer", 313, 96, 61, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label1 = GUICtrlCreateLabel("Toleranz", 573, 96, 66, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label4 = GUICtrlCreateLabel("Multiplikator", 443, 96, 89, 23)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Label5 = GUICtrlCreateLabel("Widerstandsberechner", 80, 24, 280, 36)
    GUICtrlSetFont(-1, 20, 400, 0, "Arial")
    $x = 53
    $sText = StringSplit('1;0;0;0,01;20', ';', 2)
    $limit = StringSplit('12;9;9;11;7', ';', 2)
    For $i = 0 To 4
    $aInput2[$i] = GUICtrlCreateInput($sText[$i], $x, 168, 81, 21, BitOR($ES_READONLY,$ES_RIGHT))
    GUICtrlSetLimit($aInput2[$i], $limit[$i], 0)
    $x += 130
    Next
    $Button1 = GUICtrlCreateButton("Schließen", 570, 265, 121, 30, 0)
    $Button2 = GUICtrlCreateButton("Copyright", 8, 272, 89, 25, 0)
    $Label6 = GUICtrlCreateLabel("Lösung ohne Toleranz:", 175, 217, 300, 25)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Input11 = GUICtrlCreateInput("", 350, 215, 150, 25, $ES_READONLY)
    $Label7 = GUICtrlCreateLabel("Lösung mit Toleranz:", 175, 257, 300, 25)
    GUICtrlSetFont(-1, 13, 400, 0, "Arial")
    $Input12 = GUICtrlCreateInput("", 350, 255, 150, 25, $ES_READONLY)
    GUISetState(@SW_SHOW)
    $aboutitem = TrayCreateItem("Credits")
    TrayCreateItem("")
    $exititem = TrayCreateItem("Exit")
    TraySetState()
    While 1
    $nMsg = GUIGetMsg()
    _Rechnen()
    Switch $nMsg
    Case $Button1, $GUI_EVENT_CLOSE
    Exit
    Case $Combo1
    _Rechnen()
    Case $Button2
    _credits()
    EndSwitch
    For $i = 0 To 4 ; UpDowns checken
    If $nMsg = $aInput[$i][2] Then
    GUICtrlSetData($aInput[$i][0], $arLabel[GUICtrlRead($aInput[$i][1])][$i])
    GUICtrlSetData($aInput2[$i], $arValue[GUICtrlRead($aInput[$i][1])][$i])
    _Rechnen()
    EndIf
    Next
    $msg = TrayGetMsg()
    Select
    Case $msg = 0
    ContinueLoop
    Case $msg = $aboutitem
    Msgbox(64, "Credits", "Copyright (c) xxx 2009")
    Case $msg = $exititem
    ExitLoop
    EndSelect
    WEnd
    ;------------------------------------------------------------------------------------------------------------
    Func _intro ()
    $intro = GUICreate("Spotlight", 465, 303, -1, -1)
    GUICtrlCreatePic(@Scriptdir & "\Images\logo.jpg",-1,-1,465,303)
    GUISetState(@SW_SHOW)
    Sleep(2500)
    GUIDelete()
    EndFunc
    ;------------------------------------------------------------------------------------------------------------
    Func _Rechnen()
    Switch GUICtrlRead($Combo1)
    Case 4
    $oTol = (_Switch(GUICtrlRead($aInput2[0]))*10 + _Switch(GUICtrlRead($aInput2[1])))*_Switch(GUICtrlRead($aInput2[3]))
    Case Else
    $oTol = (_Switch(GUICtrlRead($aInput2[0]))*100 + _Switch(GUICtrlRead($aInput2[1]))*10 + _Switch(GUICtrlRead($aInput2[2])))*_Switch(GUICtrlRead($aInput2[3]))
    EndSwitch
    $mTol = ($oTol - $Tol)
    $Tol = (($oTol /100)*GUICtrlRead($aInput2[4]))
    GUICtrlSetData($Input11, _Switch($oTol, 0))
    GUICtrlSetData($Input12, _Switch($mTol, 0))
    EndFunc
    ;------------------------------------------------------------------------------------------------------------
    Func _Switch($str, $pt=1)
    If $pt Then
    Return Number(StringReplace(String($str), ',', '.'))
    Else
    Return String(StringReplace(String($str), '.', ','))
    EndIf
    EndFunc
    ;------------------------------------------------------------------------------------------------------------
    Func _credits()
    $hWnd = GUICreate ("Credits",300,200,-1,-1, $WS_POPUP + $DS_SETFOREGROUND)
    GUISetBkColor (0x000000)
    GUISetState ()
    $Y = 0
    _GDIPlus_Startup()
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics(300, 200, $hGraphics)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 2)
    $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    _GDIPlus_BitmapCreateFromGraphics(300, 200, $hGraphics)
    $hFormat = _GDIPlus_StringFormatCreate ()
    _GDIPlus_StringFormatSetAlign($hFormat, 1)
    $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    $Font = _GDIPlus_FontCreate($hFamily, 25)
    $Rect = _GDIPlus_RectFCreate (0,0,300,200)
    _GDIPlus_GraphicsDrawStringEx ($backbuffer, "Copyright (c) xxx 2009", $Font, $Rect, $hFormat, $hBrush)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $bitmap, 0, 0, 300, 200)
    Do
    $Y += 1
    Sleep(15)
    DllStructSetData($Rect, "x", 0)
    DllStructSetData($Rect, "y",$Y )
    _GDIPlus_GraphicsClear($backbuffer, 0x90000000)
    _GDIPlus_GraphicsDrawStringEx ($backbuffer, "Copyright (c) xxx 2009", $Font, $Rect, $hFormat, $hBrush)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $bitmap, 0, 0, 300, 200)
    Until $Y=215
    GUIDelete()
    EndFunc

    [/autoit]
    • Offizieller Beitrag

    Dein Script funzt bei mir nach dem Compilieren einwandfrei, kein Fehler.
    Wann kommt der Fehler? Bitte genau beschreiben um es nachvollziehen zu können.

  • Also ihc compilier mit Optionen, um das Icon bei der Exe zu haben.

    Und ich versuch dann die Exe zu öffnen, und dann kommt die Fehlermeldung.

    Ich hab im Gegensatz zu euch nur noch den Ordner mit den Images...


    EDIT: Hoffentlich hab ich alles richtig gemacht :D

    • Offizieller Beitrag

    Wenn man den Fehler schon suchen soll, mußt du schon Chancengleichheit schaffen.
    Hänge den Imageordner an dein Post an.

    • Offizieller Beitrag

    Jetzt bin ich Ratlos. Habe dein Script auf der Stable und der Beta compilert und bei beiden kommt kein Fehler.

    • Offizieller Beitrag

    Deine Exe Datei funktioniert bei mir auch nicht. Habe aber keine Ahnung warum. Wenn ich deine Wiederstände.au3 compiere funktioniert alles.