Plug-In Schnittstelle

  • Und wenn Du es so in eine Text-Datei schreibst und dann weiter nutzt. Hilft das weiter? Verstehe noch nicht ganz was Du möchtest und ich bitte um Entschuldigung, wenn ich es falsch verstanden habe.

    Spoiler anzeigen
    [autoit]


    txtmake ()

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

    Func txtmake ()
    Local const $now = @ScriptDir & "\textdat.txt"
    FileWrite ($now, "$Form1 = GUICreate(""Form1"", 377, 160, 192, 124)' & @CRLF _" & @CRLF)
    FileWrite ($now, "$Button1 = GUICtrlCreateButton(""Button1"", 0, 0, 75, 25, 0)' & @CRLF _" & @CRLF)
    FileWrite ($now, "$Button2 = GUICtrlCreateButton(""Button2"", 0, 32, 75, 25, 0)' & @CRLF _" & @CRLF)
    FileWrite ($now, "$Button3 = GUICtrlCreateButton(""Button3"", 0, 64, 75, 25, 0)' & @CRLF _" & @CRLF)
    FileWrite ($now, "$Button4 = GUICtrlCreateButton(""Button4"", 0, 96, 75, 25, 0)' & @CRLF _" & @CRLF)
    FileWrite ($now, "$Button5 = GUICtrlCreateButton(""Button5"", 0, 128, 75, 25, 0)' & @CRLF _" & @CRLF)
    FileWrite ($now, "$Edit1 = GUICtrlCreateEdit("""", 80, 0, 289, 153)' & @CRLF _" & @CRLF)
    FileWrite ($now, "GUISetState(@SW_SHOW, $Form1)' & @CRLF _" & @CRLF)
    FileWrite ($now, "$x = InputBox(""Hallo"", ""Irgendwas"")' & @CRLF _" & @CRLF)
    FileWrite ($now, "GUICtrlSetData($Edit1, $x)' & @CRLF _" & @CRLF)
    FileWrite ($now, "Sleep(3000)' & @CRLF _" & @CRLF)
    FileWrite ($now, "$Form2 = GUICreate(""Form2"", 700, 700)' & @CRLF _" & @CRLF)
    FileWrite ($now, "GUISetState(@SW_SHOW, $Form2)' & @CRLF _" & @CRLF)
    FileWrite ($now, "WinSetOnTop($Form2, """", 1)' & @CRLF _" & @CRLF)
    FileWrite ($now, "GUIDelete($Form1)' & @CRLF _" & @CRLF)
    FileWrite ($now, "WinSetOnTop($Form2, """", 0)' & @CRLF _" & @CRLF)
    FileWrite ($now, "Sleep(1000)' & @CRLF _" & @CRLF)
    FileWrite ($now, "GUIDelete($Form2)' & @CRLF _" & @CRLF)
    FileWrite ($now, "MsgBox(0, """", ""Ende"")' & @CRLF _" & @CRLF)
    FileWrite ($now, "" & @CRLF)
    EndFunc

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

    Lieben Gruß,
    Alina

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Geheime Information: ;)
    k3mrwmIBHejryPvylQSFieDF5f3VOnk6iLAVBGVhKQegrFuWr3iraNIblLweSW4WgqI0SrRbS7U5jI3sn50R4a15Cthu1bEr

  • Ich arbeite dran, das ist auf jeden Fall machbar :D


    Ich frage mich wie du das realisieren willst da Execute ja nur Zeilenweise arbeitet.
    Man könnte den Quelltext höchstens in eine Textdatei schreiben und diese per AutoIt.exe ausführen...
    Ich bin da auch schon ewig dran gesessen und bin auf nix gekommen...

    Padmak

  • Warum sollte man nicht eine Datei in Zeilen zerlegen und dann einzeln ausführen?!

    Loops und Bedingungen brauchen halt ne Sonderbehandlung ;)

    • Offizieller Beitrag

    Mit viel Rückwärtsdenken bekommt man auch längere Einzeilenskripte hin.
    Hier mal ein Bsp. (hab ich glaub ich mal im EN-Forum entdeckt):

    [autoit]

    If FileWrite(@TempDir & "\temp.script.au3", _
    'While (WinExists("Beenden") '& _
    'And WinSetTitle(WinGetTitle("Beenden",""),"","Beenden " & StringRight(WinGetTitle("Beenden",""),3)-10) '& _
    'And (WinSetTrans(WinGetTitle("Beenden",""),"",StringRight(WinGetTitle("Beenden",""),3)) '& _
    'And Sleep(25)) '& _
    'And (StringRight(WinGetTitle("Beenden",""),3)>0 Or WinSetTitle(WinGetTitle("Beenden",""),"","exit") Or MsgBox(0,"",WinGetTitle("")))) '& _
    'Or (((WinExists("Ein-Zeiler") Or WinExists("exit")) Or (GUICreate("Ein-Zeiler",200,100) '& _
    'And GUISetState() And GUICtrlCreateCheckbox("Klick mich",10,10))) And Not WinExists("exit") '& _
    'And ((BitAnd(GUICtrlRead(-1),1)=1 And (MsgBox(0,"Info","Du hast die Checkbox geklickt")) And GUICtrlSetState(-1,4)) Or 1) '& _
    'And ( GUIGetMsg()<>-3 Or WinSetTitle("Ein-Zeiler","","Beenden 255")))' & @CRLF & _
    'WEnd') _
    And Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @TempDir & '\temp.script.au3"') _
    And Sleep(1000) _
    And FileDelete(@TempDir & "\temp.script.au3") Then Exit

    [/autoit]
  • Ja stimmt. Man kann die While- Schleifen auch Parallel abarbeiten lassen.

    Also ich hab jetzt mal versucht es mit den Next-Schleifen irgendwie zu schaffen. Sieht zwar nicht so Professionell aus aber darum kann man sich später kümmern:

    Spoiler anzeigen
    [autoit]

    $Source = 'For $Loop = 1 To 10' & @CRLF _
    & 'MsgBox(0,"",$Loop)' & @CRLF _
    & 'Next'

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

    _RunPlugIn($Source)

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _RunPlugIn
    ; Description ...: Führt einen Plug-In aus
    ; Syntax.........: _RunPlugIn($Source)
    ; Parameters ....: $Source - Source in AutoIt
    ; Author ........: Burak Keskin <[email='Burak.keskin@arcor.de'][/email]>
    ; ===============================================================================================================================
    Func _RunPlugIn($Source)
    $Split = StringSplit($Source, @CRLF)
    For $NextLoop = 1 To $Split[0]
    If Not $Split[$NextLoop] = "" Then
    $Split2 = StringSplit($Split[$NextLoop], "=")
    $Split3 = StringSplit($Split[$NextLoop], " ")

    If $Split2[0] > 1 Then
    Assign(StringTrimLeft(StringTrimRight($Split2[1], 1), 1), Execute(StringTrimLeft($Split2[2], 1)))
    EndIf

    If $Split2[0] = 1 Then
    Execute($Split[$NextLoop])
    EndIf

    If $Split3[1] = "For" Then ;For/Next - Schleife
    $Loop2 = ""
    $VarName = $Split3[2]
    $VarName2 = "Loop2"
    $NextLoop = True
    $VarName = StringTrimLeft($VarName, 1)
    $Loop1 = Assign($VarName, $Split3[3])
    Assign($VarName2, $Split3[6])
    $Zeilen = ""
    For $Split[$NextLoop] = 1 To $Split[0]
    If Not $Split[$Split[$NextLoop]] = "" Then
    $Zeilen = $Zeilen + 1
    EndIf
    If $Split[$Split[$NextLoop]] = "Next" Then
    ExitLoop
    EndIf
    Next

    $Zeilenstart = $Zeilen - $Zeilen + 2
    $Zeilenend = $Zeilen - 1

    For $NextLoop2 = $Loop1 To $Loop2
    For $NextLoop3 = $Zeilenstart To $Zeilenend + 1
    If Not $Split[$NextLoop3 + 1] = "" Then
    Assign($VarName, $NextLoop2)
    Execute($Split[$NextLoop3 + 1])
    Else
    EndIf
    Next
    Next
    EndIf
    EndIf
    Next
    EndFunc ;==>_RunPlugIn

    [/autoit]

    Aber irgendwie stimmt da etwas nicht so richtig und ich weiß nicht woran das liegen könnte :pinch: .
    Die Msgboxen werden 1x zu oft angezeigt.

  • So läuft es etwas besser:

    Spoiler anzeigen
    [autoit]

    $Source = FileRead(@ScriptDir&"\Plug-In.au3")

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

    _RunPlugIn($Source)

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _RunPlugIn
    ; Description ...: Führt einen Plug-In aus
    ; Syntax.........: _RunPlugIn($Source)
    ; Parameters ....: $Source - Source in AutoIt
    ; Author ........: Burak Keskin <[email='Burak.keskin@arcor.de'][/email]>
    ; ===============================================================================================================================
    Func _RunPlugIn($Source)

    Local $Timer, $Loop, $Real_Timer

    $Split = StringSplit($Source, @CRLF)

    For $NextLoop1 = 1 To $Split[0]

    If Not $Split[$NextLoop1] = "" Then

    $Split2 = StringSplit($Split[$NextLoop1], "=")
    $Split3 = StringSplit($Split[$NextLoop1], " ")
    $Split4 = StringSplit($Source, @CRLF)

    If $Split3[1] <> "For" Then
    If $Split2[0] > 1 Then
    Assign(StringTrimLeft(StringTrimRight($Split2[1], 1), 1), Execute(StringTrimLeft($Split2[2], 1)))
    ElseIf $Split2[0] = 1 Then
    Execute($Split[$NextLoop1])
    EndIf
    ElseIf $Split3[1] = "For" Then

    ;~ $Lines = _GetLines($Split4)
    $AllLines = $Split[0]
    $VarName = $Split3[2]

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

    For $NextLoop2 = 1 To $AllLines
    If Not $Split[$NextLoop2] = "" Then
    $Timer += 1
    If StringInStr($Split[$NextLoop2], "For") Then
    $StartLoop_Line = $Timer
    $Real_StartLoop_Line = $NextLoop2
    EndIf
    If StringInStr($Split[$NextLoop2], "Next") Then
    $EndLoop_Line = $Timer
    $Real_EndLoop_Line = $NextLoop2
    ExitLoop
    EndIf
    EndIf
    Next

    $StartLoop_Line += 1
    $EndLoop_Line -= 1

    Assign(StringTrimLeft($VarName, 1), $Split3[4])

    For $Loop = $Split3[4] To $Split3[6]


    For $NextLoop3 = $StartLoop_Line To $EndLoop_Line
    Execute(_ReadLine($Split, $NextLoop3))

    ;~ MsgBox(0,"",$Split3[0])
    Next

    Next


    ;~ For $Loop = $Split3[4] To $Split3[6]
    ;~ For $NextLoop3 = $StartLoop_Line To $EndLoop_Line
    ;~ Execute(_ReadLine($Split4, $NextLoop3))
    ;~ Next
    ;~ Next

    ;~ MsgBox(0,"",$Split3[4])

    EndIf
    EndIf
    Next
    EndFunc ;==>_RunPlugIn

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

    Func _GetLines($Value)
    Local $Lines
    For $NextLoop = 1 To $Value[0]
    If Not $Value[$NextLoop] = "" Then
    $Lines += 1
    EndIf
    Next
    Return $Lines
    EndFunc ;==>_GetLines

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

    Func _ReadLine($Value, $Line)
    Local $Lines = ""
    For $NextLoop = 1 To $Value[0]
    If Not $Value[$NextLoop] = "" Then
    $Lines += 1
    If $Lines = $Line Then
    Return $Value[$NextLoop]
    ExitLoop
    EndIf
    EndIf
    Next
    EndFunc ;==>_ReadLine

    [/autoit]

    Edit: Es führt nur die ersten 2 Schleifen korrekt aus und bei der 3. wird nur eine 5 eingetragen.