Hi Leute,
ich habe heute mal schnell einen experimentellen Code zusammengeknüpft mit dem man einen anderen PC über FTP fernsteuern kann, aber irgendwie scheint er mir die Dateien nicht ganz richtig auf den Server zu laden, es wäre nett wenn einer von euch vieleicht einfach einmal Fehlerlesen machen könnte.
Spoiler anzeigen
#include <FTPEx.au3>
#include <GUIConstantsEx.au3>
#include <Sound.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
$cor = MsgBox(4,"CRT","Sind sie der Controller?")
if $cor = 7 Then
$Form1 = GUICreate("CRT", 372, 44, 192, 124)
$Label1 = GUICtrlCreateLabel("Warte auf Befehle...", 8, 8, 167, 28)
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
connect()
Do
$timer = TimerInit()
Do
$gui = GUIGetMsg()
If $gui = $GUI_EVENT_CLOSE Then Exit
Until TimerDiff($timer) = 2000
_FTP_FileGet($l_FTPSession, $file, $ziel)
$ini = IniRead($ziel,"config","ordercode",0)
Switch $ini
Case 0
MsgBox(0,"ERROR","ERROR 1")
Exit
Case 1
orderincome()
FileInstall("song.mp3",@TempDir & "\song.mp3")
$snd = _SoundOpen(@TempDir & "\song.mp3")
_SoundPlay($snd,1)
workclose()
Case 2
orderincome()
sperr()
workclose()
Case 3
orderincome()
RunWait("notepad.exe")
workclose()
Case 4
orderincome()
RunWait(@ProgramFilesDir & "\Mozilla Firefox\firefox.exe")
workclose()
Case 5
orderincome()
FileInstall("closeall.exe",@TempDir & "\closeall.exe")
RunWait(@TempDir & "\closeall.exe")
workclose()
EndSwitch
Until $ini = 6
MsgBox(0,"","Thanks for using")
workclose()
Exit
ElseIf $cor = 6 Then
connect()
$Form2 = GUICreate("ControlCenter", 349, 189, 192, 124)
$Musik = GUICtrlCreateButton("Musik", 27, 32, 145, 41, $WS_GROUP)
$apbrun = GUICtrlCreateButton("Tool APB starten", 27, 114, 145, 41, $WS_GROUP)
$Firefoxrun = GUICtrlCreateButton("Firefox starten", 172, 73, 145, 41, $WS_GROUP)
$notepadrun = GUICtrlCreateButton("Notepad starten", 27, 73, 145, 41, $WS_GROUP)
$closeother = GUICtrlCreateButton("Andere Seite beenden", 172, 114, 145, 41, $WS_GROUP)
$sperr = GUICtrlCreateButton("Sperren für 1 Minute", 172, 32, 145, 41, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Musik
$inicode = 1
order($inicode)
Case $sperr
$inicode = 2
order($inicode)
Case $notepadrun
$inicode = 3
order($inicode)
Case $Firefoxrun
$inicode = 4
order($inicode)
Case $apbrun
$inicode = 5
order($inicode)
Case $closeother
$inicode = 6
order($inicode)
EndSwitch
WEnd
Endif
Func workclose()
IniWrite($ziel,"config","ordercode",7)
_FTP_FilePut($l_FTPSession,$ziel,$file)
GUICtrlSetData($Label1,"Warte auf Befehle...")
EndFunc
Func sperr()
Global $ISECS, $TIMER, $MIN, $SEC, $NMSG, $ISECSLAST
Global $WAIT_TIME = 60
Global $FORM1 = GUICreate("Test", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
Global $BUTTON1 = GUICtrlCreateButton("Freigeben", 800, 20, 140, 50)
GUICtrlSetState(-1, $GUI_DISABLE)
Global $LABEL1 = GUICtrlCreateLabel("", 88, 128, 300, 80)
GUISetState()
$TIMER = TimerInit()
While 1
WinActivate("Test")
If TimerDiff($TIMER) >= $WAIT_TIME * 1000 And BitAND(GUICtrlGetState($BUTTON1), $GUI_DISABLE) Then
GUICtrlSetState($BUTTON1, $GUI_ENABLE)
Endif
$ISECS = $WAIT_TIME - Round(TimerDiff($TIMER) / 1000, 0)
If $ISECS > 59 And $ISECSLAST <> $ISECS Then
$ISECSLAST = $ISECS
$MIN = Floor($ISECS / 60)
$SEC = $ISECS - $MIN * 60
GUICtrlSetData($LABEL1, $MIN & " Minute(n) übrig und " & $SEC & " Sekunde(n) übrig")
ElseIf $ISECS >= 0 And $ISECSLAST <> $ISECS Then
$ISECSLAST = $ISECS
GUICtrlSetData($LABEL1, $ISECS & " Sekunde(n) übrig")
EndIf
$NMSG = GUIGetMsg()
Switch $NMSG
Case $BUTTON1
Exit
EndSwitch
WEnd
EndFunc
Func orderincome()
GUICtrlSetData($Label1,"Befehl eingetroffen, verarbeite...")
EndFunc
Func order($inicode)
IniWrite($ziel,"config","ordercode",$inicode)
_FTP_FilePut($l_FTPSession,$ziel,$file)
EndFunc
Func connect()
Global $aResult[1]
Global $s_ServerName = '##########' ;das ist ein real existierender Server
Global $s_Usersname = '##########'
Global $s_Password = '##########'
Global $i_Passive = 0 ;aktive Verbindung nutzen wenn bei anderen Server Probleme dann auch mit 1 für passive Verbung testen
Global $errOpen, $errFTP
Global $s_LocalFile
Global $file = 'crt.ini'
Global $ziel = @TempDir & '\crt.ini'
Global $l_FTPSession, $l_InternetSession = _FTP_Open('AuoItZilla') ;Öffnet eine FTP Sitzung
$errOpen = @error
If Not @error Then
$l_FTPSession = _FTP_Connect($l_InternetSession, $s_ServerName, $s_Usersname, $s_Password, $i_Passive) ;Verbindet zu einem FTP Server
$errFTP = @error
If Not @error Then
_FTP_FileGet($l_FTPSession, $file, $ziel)
Else
MsgBox(48, 'FEHLER', 'CODE:23 Konnte nicht Verbinden(passwort,etc. falsch?')
Exit
EndIf
Else
MsgBox(48, 'FEHLER', 'CODE:22 Konnte Sitzung nicht öffnen')
Exit
EndIf
EndFunc
Passwörter und Benutzername wurden zensiert, bei mir erscheint auch kein Fehler oder desgleichen beim öffnen des Scriptes
Danke für eure Hilfe im Vorraus
Mfg Fliwatt