Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Donwload with HttpSetProxy

$
0
0
Hello, to start i'm french guy ( i search a answer I can not find the solution on the french forum ) so excuse me for my english....

My problem is: I search a solution to include the HttpSetProxy function in my script who's next:

I'm sorry to disturb you.




GUICreate("Telechargement de:",  400, 200, 300, 200)

Global $Progress1 = GUICtrlCreateLabel("", 105, 120, 150, 20)
Global $Pourcent1 = GUICtrlCreateLabel("(100%)", 280, 65)
Global $progressbar_traitement = GUICtrlCreateProgress(50, 80, 250, 20)
Global $label_progressbar_traitement = GUICtrlCreateLabel("", 50, 65, 150, 20)
Global $LocalFile = "C:\IFilterPDF.rar"
Global $URL = "http://www.greenpdfpaper.com/setup/documalis/IFilterPDF.rar"
Global $Download = InetGet($URL, $LocalFile, 1, 1) ;Telecharge
Global $TotalSize = 0
;$stopped = 0
Global $stop = GUICtrlCreateButton("Cancel", 220, 120, 80, 20)





GUISetState()
GUIRegisterMsg(0x0111, "WM_COMMAND")   ;0x0111= Windows code for stop


Func HttpDownloadFile($URL,$LocalFile)
GUICtrlSetData($label_progressbar_traitement, "Telechargement de:en cours ...")
_MAJ_progressbar($progressbar_traitement, $Pourcent1, 0) ; Reset the progressbar
While Not InetGetInfo($Download, 2) ;As the download is not complete
Sleep(200)
$KbRecu = InetGetInfo($Download, 0) ;Gets the Kilo Byte received

If $KbRecu > 0 Then
If $TotalSize = 0 Then
$TotalSize = InetGetInfo($Download, 1) ;Get the file size
EndIf

$Pourcentage = Round ($KbRecu / $TotalSize * 100) ;calculating the percentage
GUICtrlSetData($Pourcent1, $Pourcentage) ;transferred the percentage value of the ProgressBar
_MAJ_progressbar($progressbar_traitement, $Pourcent1, $Pourcentage)
  EndIf


WEnd
EndFunc


Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
  #forceref $hWnd, $Msg, $lParam
 Switch BitAND($wParam, 0x0000FFFF)   ; look at where the message came from
	Case $stop			; if $ stop button
		If BitShift($wParam, 16)=0 Then _Interruption()   ; and if it is clicking, then ...
 EndSwitch
  Return 'GUI_RUNDEFMSG'
EndFunc


Func _MAJ_progressbar($id_progressbar, $id_label_pourcentage, $valeur)
GUICtrlSetData($id_progressbar, $valeur)
GUICtrlSetData($id_label_pourcentage, "("&$valeur&"%)")
EndFunc



Func _Interruption()
	If MsgBox(36, "Confirmation", "Interrompre le téléchargement?") = 6 Then $run = 0
InetClose($Download)
 ;Msgbox(0,"", "")
	Exit
EndFunc


Thank you for those who take the time to read.

Quentin.

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>