Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 18:29

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Download einer Datei ohne die Seite öffnen zu müssen ?

Discussion on Download einer Datei ohne die Seite öffnen zu müssen ? within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 20
Join Date: Feb 2010
Posts: 561
Received Thanks: 257
Download einer Datei ohne die Seite öffnen zu müssen ?

Hey leute .War vor einem Jahr nen guter Coder und will jetzt wieder anfangen .
Das Problem ist über das Jahr habe ich einiges vergessen . Sitze gerade an einem Dateien Loader . Bloß wie kann ich es machen das ich auf den Button Klicke das sich die Datei die in dem Button angegeben ist Herunterlade und eine Anzeige kommt aus Autoit wie viel % Schon geladen ist . Wenn sie Fertig ist das Noch eine andere Anzeige kommt was man damit machen will z.b. Wo man sie Abspeichern will oder man sie ausführen will .

Mfg
Edit :
Das habe ich im Inet gefunden :
Code:
;Tutorial by GtaSpider

#include <GUIConstants.au3>

;Hier werden die Downloads als array deklariert. $FileToDownload[Wieviele downloads] = [Download1,Download2,...]
Global $FilesToDownload[3] = ["http://www.autoitscript.com/autoit3/files/beta/autoit/autoit-v3.2.9.4-beta-setup.exe","http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe","http://ftp-mozilla.netscape.com/pub/mozilla.org/firefox/releases/2.0.0.8/win32/de/Firefox%20Setup%202.0.0.8.exe"]
;Wieviele downloads es sind
Global $Downloads = UBound($FilesToDownload)
;Wo die daten hingeladen werden sollen
Global $DownloadDir = @ScriptDir

;Gui
GUICreate("Test", 276, 76, 193, 115)
GUISetBkColor(0)

$Progress1 = GUICtrlCreateProgress(8, 8, 262, 9,$PBS_SMOOTH)
$Progress2 = GUICtrlCreateProgress(8, 24, 262, 9,$PBS_SMOOTH)
$StatLab = GUICtrlCreateLabel("",8,59,262,15)
GUICtrlSetColor(-1,0xffffff)
$Button = GUICtrlCreateButton("Start", 8, 37, 262, 20, 0)

GUISetState()

;Mainwhile
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button
If Not _Download() Then
;Wenn es bei _Download ein error gab (Abbrechen wurde gedrückt)
GUICtrlSetData($Progress1,0)
GUICtrlSetData($Progress2,0)
GUICtrlSetState($Button,$GUI_DISABLE)
GUICtrlSetData($Button,"Abgebrochen")
Sleep(1500)
GUICtrlSetData($Button,"Neustart")
GUICtrlSetState($Button,$GUI_ENABLE)
Else
;Wenn es kein error gab
GUICtrlSetData($Button,"Erfolgreich")
GUICtrlSetData($StatLab,"Komplett")
EndIf
EndSwitch
WEnd


;Funktionen
Func _Download()
Local $i,$iSize,$iBuf,$msg,$iProz,$iOldProz,$sFileName
GUICtrlSetData($Button,"Abbrechen (0%)"); Setze button
For $i = 0 To $Downloads - 1 
$iSize = InetGetSize($FilesToDownload[$i]);Holt sich die größe des downloads
$sFileName = StringTrimLeft($FilesToDownload[$i],StringInStr($FilesToDownload[$i],"/",1,-1));Der Dateiname des downlaods
InetGet($FilesToDownload[$i],$DownloadDir&"\"&$sFileName,0,1);Datei wird gedownloadet
GUICtrlSetData($StatLab,"Download: "&$sFileName &" (0%)");Setze statuslabel
While @InetGetActive; Solange der Download aktiv ist
$msg = GUIGetMsg(); Falls Abbrechen gedrückt wird
If $msg = $Button Then Return InetGet("abort")-1 ; Return ((Returnwert von Inetget = 1) - 1) = 0
$iProz = Round(100*@InetGetBytesRead/$iSize);Gibt die Prozentzahl (gerundet) zurück
If $iProz <> $iOldProz Then;Wenn neue Prozentangaben <> alte Prozentangaben dann.. (Verhinder mögliches Flickern von Label/Button)
$iOldProz = $iProz;Setze alte Prozentangabe = neue Prozentangabe
GUICtrlSetData($Progress1,$iProz);Setze Progress 1 mit Prozentangabe des momentanen downlaods
GUICtrlSetData($Progress2,$iBuf+($iProz/$Downloads));Setze Progress 2 auf die Insgesamte Prozentanzahl
GUICtrlSetData($Button,"Abbrechen ("&Round($iBuf+($iProz/$Downloads))&"%)");Setze Abbrechenbutton
GUICtrlSetData($StatLab,"Download: "&$sFileName &" ("&$iProz&"%)");Setze Statuslabel mit Dateiname des downlaods und prozentangabe des downlaods
EndIf

Sleep(50) ;Damit Prozessorlast < 100% ;-)
WEnd
$iBuf += (100/$Downloads)
Next
Return 1
EndFunc
CrAcKxX is offline  
Old 10/25/2011, 13:12   #2
 
.2good4you111's Avatar
 
elite*gold: 20
Join Date: Oct 2010
Posts: 1,303
Received Thanks: 457
.2good4you111 is offline  
Thanks
1 User
Old 10/25/2011, 13:32   #3
 
elite*gold: 20
Join Date: Feb 2010
Posts: 561
Received Thanks: 257
Also ungefähr so :
Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Dateien Downloader", 242, 65, 192, 124)
$Button1 = GUICtrlCreateButton("Download", 8, 8, 227, 49)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button1
InetGet("http://www.mozilla.org", "C:\foo.html")
InetGet("http://www.autoitscript.com", "C:\mydownload.htm", 1)
InetGet("ftp://ftp.mozilla.org/pub/mozilla.org/README", "README.txt", 1)         ;InetGet ( "URL", "filename" [, reload [, background]] )
InetGet("http://www.nowhere.com/somelargefile.exe", "test.exe", 1, 1)

While @InetGetActive
  TrayTip("Downloading", "Bytes = " & @InetGetBytesRead, 10, 16)
  Sleep(250)
Wend

MsgBox(0, "Bytes read", @InetGetBytesRead)


	EndSwitch
WEnd
Was bedeutet das alles jetz genau ?
Das mit den Bytes ist ja Klar bloß der Teil mit InetGet verstehe ich nicht ganz was sie mit dem Beispiel meinen .
CrAcKxX is offline  
Old 10/25/2011, 13:43   #4
 
.2good4you111's Avatar
 
elite*gold: 20
Join Date: Oct 2010
Posts: 1,303
Received Thanks: 457
PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 GUICreate("Dateien Downloader"24265192124)
$Button1 GUICtrlCreateButton("Download"8822749)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
        Case 
$Button1
            InetGet
("http://www.mozilla.org/xyz.exe""Datei.exe")
            
MsgBox(0,"Info","Download abgeschlossen...")
    EndSwitch
Wend 
.2good4you111 is offline  
Thanks
1 User
Old 10/25/2011, 13:51   #5
 
elite*gold: 20
Join Date: Feb 2010
Posts: 561
Received Thanks: 257
Okay so weit so gut .
Nun muss ich wissen wohin die Datei gespeichert wird . Dann weiß ich alles
Und noch eine Frage ...
Es gibt ja den Koda Designer . Aber es gibt ja auch designer die die GUI besser aussehen lassen .
Kennt jemand einen davon ?
CrAcKxX is offline  
Old 10/25/2011, 14:10   #6
 
.2good4you111's Avatar
 
elite*gold: 20
Join Date: Oct 2010
Posts: 1,303
Received Thanks: 457
Lies dir am besten die Funktionen die du brauchst in der Help Datei durch...
So lernst du auch was dabei
.2good4you111 is offline  
Old 10/25/2011, 14:25   #7
 
elite*gold: 20
Join Date: Feb 2010
Posts: 561
Received Thanks: 257
Werd ich machen
Kennst du vllt. soeinen Designer ?
CrAcKxX is offline  
Old 10/25/2011, 23:18   #8
 
bollen's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 221
Received Thanks: 71
Koda ist soweit ich weis das Mächtigste gui Desiner tool das es zur Zeit gibt.
alternative ist der Handbetrieb
bollen is offline  
Old 10/26/2011, 00:39   #9
 
elite*gold: 0
Join Date: Mar 2011
Posts: 8,645
Received Thanks: 3,454
Oder nimm denhier
Freddy​ is offline  
Reply


Similar Threads Similar Threads
[C#] Bei klick nach einer datei suchen und öffnen
03/21/2011 - .NET Languages - 4 Replies
Hi! Ich bin leider noch ein Anfänger in C#, nur vorweg. Vielen Dank an alle die Versuchen mir zu helfen ;) So zu meiem Problem: Langfassung: Ich möchte einen Kalender schreiben mit einer richtextbox (was ich schon habe).
Error beim Öffnen einer .png Datei
01/09/2011 - General Art - 4 Replies
Ich wollte gerade mal einen Stock mit PS öffnen, da bekam ich folgende Error-Meldung. Ich verstehe nicht, warum die Meldung auftaucht, es ist ist eine .png Datei und andere .png Dateien kann ich problemlos öffnen. Wäre dankbar, wenn ihr mir helfen würdet.
[How To]Warrock Einstellungen ändern ohne Warrock öffnen zu müssen!
09/30/2010 - WarRock Guides, Tutorials & Modifications - 8 Replies
Hallo Leute, ich habe hier nochnie soetwas ähnliches gelesen/gesehen und da es ziehmlich hilfreich sein kann, schreibe ich es nun für euch. Inhalt: Die Möglichkeiten & Beschreibung der Funktionen Wie ihr es ändert.



All times are GMT +1. The time now is 18:29.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.