Undeclared Variable auf Line -1?

  • Hi, Ich hab mal als mir langweilig war (und zur "entspannung") ein Downloader angefangen, er labert ab und zu etwas vor sich in ("information received", etc...) und ich versuche
    gerade eine KOmmandozeil-unterstützung (inetget <url> <Speicherpfad>) hinzubekommen, aber immer wenn ich das Script compile und Mit der CMD so aufrufe:
    "inetget <url> C:\testfile.exe" (ohne die "")

    Kommt das Loading fenster, welches auch kommen soll und anschließend die Warnmeldung

    "Line -1:
    Error: Variable used without being declared"

    Aber da mir Line -1 nicht sehr viel sagt und ich den Fehler selber nicht funde wollte ich euch mal um Hilfe bitten...

    Spoiler anzeigen
    [autoit]

    #cs $size = InetGetSize ("http://www.vbox.me/?path=./VirtualBox%20v3.0.2&file=Portable-VirtualBox_v3.0.2-Starter_v3.1.0-Win32_64.exe")
    MsgBox (0, "Download", "URL: " & $url & @CRLF & "Size: " & $size & @CRLF & "Destionation: " & $dest)
    #ce InetGet ("http://www.vbox.me/?path=./VirtualBox%20v3.0.2&file=Portable-VirtualBox_v3.0.2-Starter_v3.1.0-Win32_64.exe", @ScriptDir & "\portable vb.exe")
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    $cmd = False
    $infogetted = False
    IF $CMDLINE[0] <> 0 Then
    $cmd = True
    EndIf
    GUICreate ("tit", "200", 100)
    $label = GUICtrlCreateLabel ("Loading...", 20, 20, 100)
    GUICtrlSetFont ($label, 14, "", "", "Arial")
    GUISetState (@SW_SHOW)
    GUISetStyle ($WS_POPUP)
    SoundPlay (@ScriptDir & "\sounds\data established.mp3", 1)
    $ping = Ping ("autoitscript.com")
    $internet = True
    GUIDelete ()
    If $ping == 0 Then
    $i = 0
    Do
    $ping = Ping ("autoitscript.com")
    $i += 1
    Until $i = 20 Or $ping <> 0
    If $ping = 0 Then
    MsgBox (0, "Error", "Please check youre internet-conection!")
    $internet = False
    EndIf
    EndIf
    If $cmd = False Then
    MsgBox (0, "", @ScriptLineNumber)
    #Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\keno\eigene dateien\eigene dokumente\koda\au3 download.kxf
    $Form1 = GUICreate("Au3 Download", 633, 447, 192, 124)
    $Label1 = GUICtrlCreateLabel("Download URL:", 8, 8, 80, 17)
    $urlfiled = GUICtrlCreateInput("", 96, 8, 401, 21)
    $Label2 = GUICtrlCreateLabel("Destionation:", 8, 40, 66, 17)
    $destfield = GUICtrlCreateInput("", 96, 40, 401, 21)
    $searchHD = GUICtrlCreateButton("Search", 512, 40, 75, 25, $WS_GROUP)
    $Label3 = GUICtrlCreateLabel("Informations", 16, 128, 100, 23)
    GUICtrlSetFont(-1, 12, 800, 0, "Arial")
    $getInfo = GUICtrlCreateButton("Get Info's", 512, 8, 75, 25, $WS_GROUP)
    $infoedit = GUICtrlCreateEdit("", 16, 152, 273, 289)
    $go = GUICtrlCreateButton("Start downoading!", 304, 152, 323, 289, $WS_GROUP)
    GUICtrlSetFont(-1, 14, 400, 0, "Arial")
    GUICtrlSetColor(-1, 0xFF0000)
    ;$multi = GUICtrlCreateButton("Multiple Download", 496, 80, 107, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $goloding = "abcdefghi"
    $n = 1
    EndIf
    If $internet = True Then SoundPlay (@ScriptDir & "\sounds\internet.mp3")
    $msg = GUIGetMsg ()
    If $cmd == True Then $msg = $getInfo
    While 1
    If $msg = -3 Then Exit
    If $msg = $getInfo Then
    MsgBox (0, "", @ScriptLineNumber)
    GUICtrlSetData ($infoedit, "Getting data...")
    If $cmd = False Then
    $size = InetGetSize (GUICtrlRead ($urlfiled))
    $url = GUICtrlRead ($urlfiled)
    Else
    $size = InetGetSize ($CMDLINE[1])
    $url = $CMDLINE[1]
    EndIf
    $anbieter = StringSplit ($url, "/")
    $anbieter1 = $anbieter[1]
    If $anbieter [1] = "http:" Then $anbieter1 = $anbieter[3]
    If $anbieter[1] = "ftp:" Then $anbieter1 = $anbieter[3]
    $fname = $anbieter[$anbieter[0]]
    $ping = Ping ($anbieter1)
    If $cmd = False Then
    If GUICtrlRead ($urlfiled) <> "" Then
    SoundPlay (@ScriptDir & "\sounds\inforeceived.mp3")
    EndIf
    EndIf
    $infogetted = True
    If $cmd = True Then $n = $goloding
    If $cmd = False Then GUICtrlSetData ($infoedit, "File size (in bytes): " & $size & @CRLF & @CRLF & "Ping-Geschwindigkeit: " & $ping & "ms" & @CRLF & @CRLF & "Download URL: " & $url & @CRLF & @CRLF & "URL of download host: " & $anbieter1 & @CRLF & "File name: " & $fname)
    EndIf
    If $msg = $searchHD Then
    If $infogetted = True Then
    $path = FileOpenDialog ("Au3 Download", @DesktopDir, "*.* (All files)", "", $fname)
    Else
    $path = FileOpenDialog ("Au3 Download", @DesktopDir, "*.* (All files)", "")
    EndIf
    If @error Then
    $path = ""
    ElseIf Not @error Then
    GUICtrlSetData ($destfield, $path)
    $path = ""
    EndIf
    EndIf
    If $msg == $go Then
    If $infogetted = False Then
    #cs
    #ce
    GUICtrlSetData ($infoedit, "Getting data...")
    If $cmd = False Then
    $size = InetGetSize (GUICtrlRead ($urlfiled))
    $url = GUICtrlRead ($urlfiled)
    EndIf
    $anbieter = StringSplit ($url, "/")
    $anbieter1 = $anbieter[1]
    If $anbieter [1] = "http:" Then $anbieter1 = $anbieter[3]
    If $anbieter[1] = "ftp:" Then $anbieter1 = $anbieter[3]
    $fname = $anbieter[$anbieter[0]]
    $ping = Ping ($anbieter1)
    If $cmd = False Then
    If GUICtrlRead ($urlfiled) <> "" Then
    ;SoundPlay (@ScriptDir & "\sounds\inforeceived.mp3")
    EndIf
    EndIf
    $infogetted = True
    If $cmd = True Then $n = $goloding
    If $cmd = False Then GUICtrlSetData ($infoedit, "File size (in bytes): " & $size & @CRLF & @CRLF & "Ping-Geschwindigkeit: " & $ping & "ms" & @CRLF & @CRLF & "Download URL: " & $url & @CRLF & @CRLF & "URL of download host: " & $anbieter1 & @CRLF & "File name: " & $fname)
    EndIf
    #cs
    #ce
    $url = GUICtrlRead ($urlfiled)
    $path = GUICtrlRead ($destfield)
    $text = GUICtrlRead ($infoedit)
    GUISetState (@SW_HIDE)
    #Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\keno\eigene dateien\eigene dokumente\koda\au3 download stage 2.kxf
    $2Form1 = GUICreate("Downloading...", 340, 248, 652, 140)
    $2Label1 = GUICtrlCreateLabel("Downlaoding...", 8, 16, 299, 17)
    $2Edit1 = GUICtrlCreateEdit("", 8, 40, 297, 121)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Progress = GUICtrlCreateProgress(8, 176, 294, 17)
    $run = GUICtrlCreateButton("Run File", 8, 208, 75, 25, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $openfolder = GUICtrlCreateButton("Open containing folder", 88, 208, 139, 25, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    SoundPlay (@ScriptDir & "\sounds\beaming data.mp3", 0)
    GUICtrlSetData ($2Edit1, $text)
    InetGet ($url, $path, 1, 1)
    $size = InetGetSize (GUICtrlRead ($urlfiled))
    $1Procent = $size / 100
    $c = 100 / $size
    While @InetGetActive
    GUICtrlSetData ($progress, Round(@InetGetBytesRead * 100 /$Size,1))
    If GUIGetMsg () == -3 Then
    FileDelete ($path)
    ExitLoop
    Endif
    GUICtrlSetData ($2Label1, "Downloading... " & @InetGetBytesRead & " of " & $size & " bytes loaded.")
    WEnd
    If FileExists ($path) Then
    GUICtrlSetData ($2Edit1, "Downloaded Successfull!")
    GUICtrlSetState ($run, $GUI_ENABLE)
    GUICtrlSetState ($openfolder, $GUI_ENABLE)
    Else
    GUICtrlSetData ($2Edit1, "Sorry, The File " & $path & " does not exist.")
    EndIf
    Do
    $msg = GUIGetMsg ()
    If $msg = $run Then
    ShellExecute ($path)
    EndIf
    If $msg = $openfolder Then
    $split = StringSplit ($path, "\")
    $i = 1
    $pathn = ""
    Do
    $pathn &= $split[$i] & "\"
    $i += 1
    If $i -1 == $split[0] -1 Then ExitLoop
    Until $pathn == 1
    ShellExecute ("explorer.exe", $pathn & ",/e,/select," & $pathn & $split[$split[0]])
    EndIf
    Until $msg = -3
    GUIDelete ($2Form1)
    GUISetState (@SW_SHOW)
    EndIf
    If $n = $goloding Then
    MsgBox (0, "", @ScriptLineNumber)
    #Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\keno\eigene dateien\eigene dokumente\koda\au3 download stage 2.kxf
    $2Form1 = GUICreate("Downloading...", 340, 200, 192, 124)
    $2Label1 = GUICtrlCreateLabel("Downlaoding...", 8, 8, 300, 17)
    $2Edit1 = GUICtrlCreateEdit("", 8, 32, 297, 121)
    $Progress = GUICtrlCreateProgress(16, 168, 294, 17)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $size = InetGetSize ($CMDLINE[1])
    $spltx = StringSplit ($CMDLINE[1], " ")
    $url = $spltx[1]
    $path = $spltx[3]
    $size = InetGetSize ($url)
    GUICtrlSetData ($2Edit1, "File size (in bytes): " & $size & @CRLF & @CRLF & "Ping-Geschwindigkeit: " & $ping & "ms" & @CRLF & @CRLF & "Download URL: " & $url & @CRLF & @CRLF & "URL of download host: " & $anbieter1 & @CRLF & @CRLF & "File name: " & $fname)
    InetGet ($url, $path, 1, 1)
    While @InetGetActive
    GUICtrlSetData ($2Label1, "Downloading... " & @InetGetBytesRead & " of " & $size & " loaded.")
    WEnd
    If FileExists ($path) Then
    MsgBox (0, "", "Download Successfull!")
    Else
    MsgBox (0, "Error", "File couldn't be downloaded.")
    EndIf
    Exit
    EndIf

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

    $msg = GUIGetMsg ()
    If $infogetted = True Then
    If GUICtrlRead ($urlfiled) <> $url Then $infogetted = False
    EndIf
    WEnd
    Func OnAutoItExit ()
    GUIDelete ()
    SoundPlay (@ScriptDir & "\sounds\data lost.mp3")
    Sleep (2500)
    EndFunc

    [/autoit]

    P.S.:
    Wenn ich an der Stelle

    [autoit]

    $cmd = False
    $infogetted = False

    [/autoit]


    Noch MsgBox (0, "", @ScriptLineNUmber) hinterhänge ist die Antowrt auch -1...
    Liegt es dran das das Script compiled ist?

    Thx schonmal, Das Schwert

    Theorie ist wenn man weiß wie's geht, aber nichts klappt.
    Praxis ist wenn's klappt aber man weiß nicht weiso.

    Bei Microsoft sind Theorie und Praxis vereint: Nichts klappt und keiner weiß wieso ;)

    Einmal editiert, zuletzt von Das Schwert (26. August 2009 um 10:37)

  • Jetzt läuft der Script...

    Falls irgendwer an einem sprechenden Download Programm intressiert ist:

    Hier ist das Programm als zip (wegen den tönen dabei...)

    Oder falls sich jmd daran stört das da nur "Hier" steht:
    http://schwertsoft.sc.funpic.de/inetget.zip

    Das Schwert :rock:

    Theorie ist wenn man weiß wie's geht, aber nichts klappt.
    Praxis ist wenn's klappt aber man weiß nicht weiso.

    Bei Microsoft sind Theorie und Praxis vereint: Nichts klappt und keiner weiß wieso ;)

  • [autoit]


    Opt ("MustDeclareVars", 1)
    Opt("MustDeclareVars", 1)
    Opt("MustDeclareVars", 1)

    [/autoit]


    3x meinste nicht das einmal gereicht hätte ?

  • Das Schwert
    Also wie Dir schon via PN gestern geschrieben, würde ich die Sounds selber noch mal aufnehmen. Micro und rein in den PC über die Soundkarte.
    Ansonsten sicherlich eine andere Art auf etwas hin-zu-wei-sen, als immer über MsgBox.
    Aber man kann daraus etwas lustiges machen. Zum Beispiel wenn man im Netz ist ein lustiger Spruch und wenn der Download fertig ist einen "kleinen Landwirt" (Bäucherchen) ertönen lassen. Wenn das dann einer im Büro zum Beispiel nutzt und die Boxen an hat, dann ist minimal eine Person mit einem roten Kopf anwesend.

    :rofl: LACH :rofl: MICH :rofl: WEG :rofl:

    Lieben Gruß,
    Alina

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

    Geheime Information: ;)
    OuBVU5ebLhHu5QvlnAyQB4A7SzBrvWulwL7RLl2BdH5tI6sIYspeMKeXMSXl