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
#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
$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
P.S.:
Wenn ich an der Stelle
$cmd = False
$infogetted = False
Noch MsgBox (0, "", @ScriptLineNUmber) hinterhänge ist die Antowrt auch -1...
Liegt es dran das das Script compiled ist?
Thx schonmal, Das Schwert