Hallo , seit etwa 4 Wochen arbeit ich mit AutoIT und die Benutzeroberfläche hat mich begeistert , leider bin ich ein Neuling. Dennoch läuft mein erstes Script , der IGR (Idealgewichtsrechner), recht gut.
Mein Problem zeigt sich bei der Eingabe von Schriftzeichen anstelle von Zahlen , hier kommt es natürlich zu Fehlern.
Eine IF Else IsNumber müsste eingebaut werden - aber wie und wo?
Was kann ich besser machen?
#include <GUIConstants.au3>
[/autoit][autoit][/autoit][autoit]$Form1_1 = GUICreate(" IGR", 370, 300, 193, 115)
GUISetFont(12, 400, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel(" Ihr IdealGewichtsRechner ", 32, 32, 318, 30)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput(" Hier Ihre Körpergröße in cm eingeben !", 40, 96, 289, 30)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Idealgewicht berechnen", 40, 152, 289, 30, 0)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Ihr Idealgewicht in kg :", 88, 216, 187, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("-kein-", 160, 256, 43, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("V 2.0 Build 20070820", 0, 280, 107, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Icon1 = GUICtrlCreateIcon("Smiley12.ico", 0, 296, 240, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
$Label5 = GUICtrlCreateLabel("Kiesi", 344, 280, 27, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
If $nMsg <> 0 Then
$Zahl1 = GUICtrlRead ( $Input1 )
Select
Case $nMsg = $Button1
GUICtrlSetData ($Label3, ( $Zahl1 - 100 ) * 0.9 )
Case $nMsg = $GUI_EVENT_CLOSE
Exit
ExitLoop
EndSelect
EndIf
WEnd
[/autoit]