Scriptfehler nur bei ext Aufruf

  • Hallozusammen,
    ich habe eine Frage zu einem merkwürdigen Fehler.

    Wenn ich meine "Sctipt.exe" per Hand also per Doppelclick aufrufe funktioniert es perfekt.
    Wird das Programm jeoch von "extern" also einen anderen Programm aufgerufen, so spricht gleich meine MsgBox an mit "Unable to open the config.txt"!

    Hat jemand eine Idee wiso dies so ist?
    Hier ein Teil meines Prog.

    [autoit]

    $file=FileOpen("config.txt",0)
    $drive=FileReadLine("config.txt",4)
    $Comport=FileReadLine("config.txt",6)
    $Anzahl=FileReadLine("config.txt",8)
    $Version=('V:X:30:2:E');Robotic Version Info Command
    $Calibration=('C:X:30:2:E');Calibration Command
    $Load=('I:X:30:2:E');Get Input (load) Command
    $Unload=('A:X:30:2:E');Unload the Drive Command
    HotKeySet("{ESC}","_exit")
    Global $iCount = 1

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

    if $file=-1 Then
    MsgBox(0,"Error","Unable to open the config.txt")
    Exit
    EndIf

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

    RunWait('load.exe --comport='&$comport&' --drive='&$drive&' --command='&$Version&'')

    [/autoit]

    Danke für Eure Antworten

  • bitte

    Spoiler anzeigen
    [autoit]

    $file=FileOpen(@ScriptDir & "\config.txt",0)
    $drive=FileReadLine(@ScriptDir & "\config.txt",4)
    $Comport=FileReadLine(@ScriptDir & "\config.txt",6)
    $Anzahl=FileReadLine(@ScriptDir & "\config.txt",8)
    $Version=('V:X:30:2:E');Robotic Version Info Command
    $Calibration=('C:X:30:2:E');Calibration Command
    $Load=('I:X:30:2:E');Get Input (load) Command
    $Unload=('A:X:30:2:E');Unload the Drive Command
    HotKeySet("{ESC}","_exit")
    Global $iCount = 1

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

    if $file=-1 Then
    MsgBox(0,"Error","Unable to open the config.txt")
    Exit
    EndIf

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

    RunWait('load.exe --comport='&$comport&' --drive='&$drive&' --command='&$Version&'')

    [/autoit]

    Das finden von Rechtschreibfehlern muss sofort und unverzüglich dem Autor gemeldet werden. Das eigennützige Verwenden dieser Rechtschreibfehler ist strengstens untersagt und kann mit Freiheitsenzug bestraft werden.

  • Danke für die schnellen Antworten....

    Werde es gleich testen!

    Danke und frohe Ostern