Wie sollen AutoIt Scripte untereinander kommunizieren?

  • Hallo Leute,

    ich habe mehrere AutoIt Scripte, die bisher noch mit UPD oder TCP miteinander kommunizieren. Sobald die Scripte nicht mehr auf den gleichen Rechner laufen ist das wohl auch die beste Möglichkeit.
    Meine Scripte laufen allesdings alle auf dem gleichen Rechner und nun frage ich mich, ob es da schönere, schnellere Methoden gibt.
    Habe in der Hile bei AutoItWinGetTitle() und AutoItWinSetTitle() hinweise gelesen, aber keine konkreten Funktionsnamen oder so was.

    Gruß

  • Bsp (Skripte natürlich noch trennen):

    Spoiler anzeigen
    [autoit]


    ;Script2 -> Sender
    #include "MessageHandler.au3"

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

    $Local_ReceiverID_Name = "Script2sReceiverID";This is the ID that the other script will use to send data
    $Remote_ReceiverID_Name = "Script1sReceiverID";This is the ID of the script we want to send data too

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

    $hwnd = _SetAsReceiver($Local_ReceiverID_Name)
    ConsoleWrite("hwnd of the Local_ReceiverID_Name is " & $hwnd & @crlf)
    $myFunc = _SetReceiverFunction("_MyFunc2")
    ConsoleWrite("My data receiver function is " & $myFunc & @crlf)

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

    $Str = InputBox(@ScriptName," I am " & @ScriptName & @crlf & "Enter some data to be sent to the other script")

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

    $iSent = _SendData($Str,$Remote_ReceiverID_Name)

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

    While 1
    sleep(100)
    WEnd

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

    Func _MyFunc2($vText)
    Msgbox(0,@ScriptName,@ScriptName & " has received a message" & @crlf & $vText)
    Exit
    EndFunc

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

    ;Script1 -> Empfänger
    #include "MessageHandler.au3"

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

    $Local_ReceiverID_Name = "Script1sReceiverID";This is the ID that the other script will use to send data
    $Remote_ReceiverID_Name = "Script2sReceiverID";This is the ID of the script we want to send data too

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

    $hwnd = _SetAsReceiver($Local_ReceiverID_Name)
    ConsoleWrite("hwnd of the Local_ReceiverID_Name is " & $hwnd & @crlf)
    $myFunc = _SetReceiverFunction("_MyFunc2")
    ConsoleWrite("My data receiver function is " & $myFunc & @crlf)

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

    While 1
    Sleep(1000)
    WEnd

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

    Func _MyFunc2($vText)
    Msgbox(0,@ScriptName,"I am " & @ScriptName & " I have received some data" & @crlf & @crlf & $vText & @crlf & @crlf & "And now I'm sending the data back")
    $iSent = _SendData($vText,$Remote_ReceiverID_Name)
    Exit
    EndFunc

    [/autoit]
  • Hallo,

    habe jetzt folgende Wege gefunden:
    - Messagehandler.au3
    - CoProc.au3
    - CopyData Windows Message

    welches ist denn jetzt die beste Methode (Schnelligkeit, Universal)?
    Was habt ihr schon genutzt, falls ich Hilfe brauche, verstehe das mit dem DLLs noch nicht (kann ich mir da was zu durchlesen?)

  • habe mir jetzt mal CoProc angeschaut, arbeitet auch mit WM_CopyData...

    also hat sich meine Frage wohl geklärt, da alle drei Varianten auf die gleiche WindowsFunktion zurück greifen.

    Dann werde ich diese wohl nehmen und schauen welche UDF mir besser gefällt.