Hilfe if-schleife funktioniert nicht

07/11/2009 15:01 blubablubafasel#1
schauts euch selber an:


HotKeySet("{F7}" , "Login")

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\marc\documents\form1.kxf
$Form1_1 = GUICreate("Form1", 625, 445, 192, 124)
$Benutzername = GUICtrlCreateInput("Benutzername", 24, 16, 249, 21)
$Passwort = GUICtrlCreateInput("Passwort", 24, 56, 249, 21)
$Server = GUICtrlCreateInput("Server", 24, 96, 65, 21)
$Channel = GUICtrlCreateInput("Channel", 24, 136, 65, 21)
$Charakter = GUICtrlCreateInput("Charakter", 24, 176, 65, 21)
$OK = GUICtrlCreateButton("OK", 136, 248, 353, 153, $WS_GROUP)
GUISetState(@SW_SHOW)
Dim $Form1_1_AccelTable[1][2] = [["{F7}", $OK]]
GUISetAccelerators($Form1_1_AccelTable)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd
Func Login ()
While 1
If $Server = 1 Then
MouseMove(23, 345)
EndIf
WEnd

EndFunc
While 1
sleep (1)
WEnd
07/11/2009 15:11 bUTL9R#2
Es gibt keine If-Schleifen.

Bzw. du musst erstmal das Input auslesen , bevor du damit weiterarbeiten kannst.
Stichwort GUICtrlRead.
07/11/2009 15:15 Mankana#3
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Nach der Initialisierung befindet sich dein Programm permanent in dieser Schleife.
Wenn du jetzt noch hinzufügst:

Case $OK
Login()

müsste das klappen.
Das sieht dann so aus:

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $OK
Login()
EndSwitch
WEnd

Die letzte Schleife

While 1
sleep (1)
WEnd

ist übrigens unnütz, da du dich die ganze Zeit in der ersten While Schleife befindest.
07/11/2009 15:20 bUTL9R#4
Mankan :
mit der Zeile "HotKeySet("{F7}" , "Login")"
wird auch erst die Loginserver Abfrage gestartet. Sein Problem war, dass er nicht das Input ausgelesen hat , bevor er abgefragt hat was darin stand.
07/11/2009 15:29 blubablubafasel#5
so hab mal n bisschen rumprobiert und geht noch immer nich:


HotKeySet("{F7}" , "Login")

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\marc\documents\form1.kxf
$Form1_1 = GUICreate("Form1", 625, 445, 192, 124)
$Benutzername = GUICtrlCreateInput("Benutzername", 24, 16, 249, 21)
$Passwort = GUICtrlCreateInput("Passwort", 24, 56, 249, 21)
$Server = GUICtrlCreateInput("Server", 24, 96, 65, 21)
$Channel = GUICtrlCreateInput("Channel", 24, 136, 65, 21)
$Charakter = GUICtrlCreateInput("Charakter", 24, 176, 65, 21)
$OK = GUICtrlCreateButton("OK", 136, 248, 353, 153, $WS_GROUP)
GUISetState(@SW_SHOW)
Dim $Form1_1_AccelTable[1][2] = [["{F7}", $OK]]
GUISetAccelerators($Form1_1_AccelTable)
#EndRegion ### END Koda GUI section ###
GUICtrlRead($Server)
Func Login ()

If $Server = 1 Then
Do
MouseMove(23, 345)
EndIf

EndFunc
While 1
sleep (1)
WEnd



While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd
07/11/2009 15:47 Mankana#6
Ich habe die HotKeySet Funktion übersehen..

Deine If Abfrage fragt den Inhalt der Variable $Server ab, welcher die
Control ID ist. Du brauchst GUICtrlRead($Server) um den Text der in der
Inputbox steht auszulesen. Das hast du zwar schon weiter oben zu stehen
aber da bringt es dir nichts.

Das "Do" bei der If Anfrage muss weg

While 1
sleep (1)
WEnd

Diese While Schleife musst du noch entfernen dann passt alles solange du
in der Server Inputbox eine 1 zu stehen hast
07/11/2009 16:09 blubablubafasel#7
hmmm das geht iwie nicht.... kannste mal pls das funktionierende skript reinstellen?
07/11/2009 16:14 Mankana#8

Vorraussetzung das sich der Zeiger bewegt ist natürlich das du in der Server Inputbox
eine 1 zu stehen hast.