Script mit Parametern starten

  • Hallo,

    ich benutze in früheren AutoIt Version folgende Funktion um mein Script beim Testen mit Paramtern zu starten:

    [autoit]

    Func _runSelf($command)
    Local $pid
    If @Compiled Then
    $pid = Run(@ScriptFullPath & ' ' & $command, '', @SW_HIDE, 2 + 1)
    Else
    $pid = Run(@AutoItExe & " " & @ScriptFullPath & ' ' & $command, "", @SW_SHOW, 2 + 1)
    EndIf

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

    Return $pid
    EndFunc ;==>_runSelf

    [/autoit]

    Seit dem ich auf die neuste Verison von AutoIt umgestiegen bin geht das leider nicht mehr.
    Weiß jemand woran das liegt und wie ich es lösen könnte?

  • probiers mal so:

    [autoit]


    Func _runSelf($command)
    Local $pid
    If @Compiled Then
    $pid = Run(@ComSpec & ' /c ' & @ScriptFullPath & ' ' & $command, '', @SW_HIDE)
    Else
    $pid = Run(@ComSpec & ' /c ' & @AutoItExe & " " & @ScriptFullPath & ' ' & $command, "", @SW_SHOW)
    EndIf
    Return $pid
    EndFunc ;==>_runSelf

    [/autoit]
    • Offizieller Beitrag

    Wenn ich das als Beispiel verwende:

    Spoiler anzeigen
    [autoit]


    Global $pid

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

    If $CmdLine[0] = 0 Then
    $pid = _runSelf('load')
    ConsoleWrite('PID: ' & $pid & @CR)
    Exit
    EndIf
    MsgBox(0, 0, 'Start with Command: ' & $CmdLine[1])

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

    Func _runSelf($command)
    Local $pid
    If @Compiled Then
    $pid = Run(@ScriptFullPath & ' ' & $command, '', @SW_HIDE, 2 + 1)
    Else
    $pid = Run(@AutoItExe & " " & @ScriptFullPath & ' ' & $command, "", @SW_SHOW, 2 + 1)
    EndIf
    Return $pid
    EndFunc ;==>_runSelf

    [/autoit]


    funktioniert das bei mir (mit v3.3.12.0) sowohl compiliert als auch von SciTE aus gestartet einwandfrei.