Problem mit Login Script

06/26/2011 21:19 LiiiKeYou#1
Hallo.
Ich hab jetzt ein Problem mit meinen Login Scirpt.
Hier ist der Source:

Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Login#", 264, 305, 192, 124)
$Button1 = GUICtrlCreateButton("Login", 16, 208, 225, 41, $WS_GROUP)
$id = GUICtrlCreateInput("", 24, 72, 209, 21)
$Label1 = GUICtrlCreateLabel("Benutzername", 88, 40, 72, 17)
$Label2 = GUICtrlCreateLabel("Passwort", 104, 112, 47, 17)
$pw = GUICtrlCreateInput("", 24, 144, 209, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
			Case $Button1
If $id = "test" and $pw = "test" Then
	MsgBox (64,"Erfolgreich", "Sie wurden erfolgreich eingeloggt!")
Else
	MsgBox (64, "Fehlgeschlagen", "Sie haben die falschen Daten eingegeben!")
	EndIf
	EndSwitch
WEnd
Wenn ich aber nun die richtigen Daten, nämlich test als id & test als passwort eingebe kommt die Fehlermeldung, also ,,Sie haben die Daten falsch eingegeben!"
Was mache ich falsch? ôo
Kann mir einer helfen?

Danke im Vorraus!
06/26/2011 21:37 lolkop#2
du musst die guicontrols per guictrlread oder controlgettext auslesen.

in den variablen wird bei der erstellung des controls lediglich das handle des controls gespeichert.
06/26/2011 22:19 xShizoidx#3
Blubb

Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Login#", 264, 305, 192, 124)
$Button1 = GUICtrlCreateButton("Login", 16, 208, 225, 41, $WS_GROUP)
$id = GUICtrlCreateInput("", 24, 72, 209, 21)
$Label1 = GUICtrlCreateLabel("Benutzername", 88, 40, 72, 17)
$Label2 = GUICtrlCreateLabel("Passwort", 104, 112, 47, 17)
$pw = GUICtrlCreateInput("", 24, 144, 209, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
			Case $Button1
If GUICtrlRead($id) = "test" and GUICtrlRead($pw) = "test" Then
	MsgBox (64,"Erfolgreich", "Sie wurden erfolgreich eingeloggt!")
Else
	MsgBox (64, "Fehlgeschlagen", "Sie haben die falschen Daten eingegeben!")
	EndIf
	EndSwitch
WEnd
Bitte schön.
06/27/2011 14:51 LiiiKeYou#4
Dankeschön.
Hat geklappt <3