en regardant les sources update du forumcolor
voir ici http://www.autoitscript.fr/forum/downlo ... lor152.zip
merci à VooDoo
j'ai pensé l'utiliser pour télécharger comme je le fait avec ie
et cela fonctionne très bien
voici ma modif
Code : Tout sélectionner
#include <GUIConstants.au3>
#include <Date.au3>
#Include <String.au3>
majparftp ( )
func majparftp ( )
Global $info , $v_maj_fc , $v_fc , $v_maj_UD , $progress , $siteftp = "192.168.0.101" , $login = "login" , $password = "mon passe" , $dossierftp = "" , $fichierftp = "fichier.txt"
;~ test d'acces au site FtpSetProxy
$var = Ping ( $siteftp , 4000 )
If $var Then Else
Msgbox ( 0 , "Le site FTP n'est pas accessible" , 5 ) Return
EndIf
GUICreate ( "Mise a jour fichier ftp" , 400 , 200 , - 1 , - 1 , - 1 , $WS_EX_TOOLWINDOW )
$progress = GUICtrlCreateProgress ( 0 , 130 , 400 , 20 )
$info = GUICtrlCreateEdit ( "" , 0 , 0 , 400 , 125 , $ES_NOHIDESEL + $ES_READONLY , $WS_EX_CLIENTEDGE )
GUICtrlSetFont ( - 1 , - 1 , 5000 )
$lbl_ver_UD = GUICtrlCreateLabel ( "" , 110 , 175 , 100 )
GUISetState ( )
maj_ud ( )
GUIDelete ( )
EndFunc
Func info ( $msg )
GUICtrlSetData ( $info , GUICtrlRead ( $info ) & @CRLF & $msg )
EndFunc ; == >info
Func Affichage ( $inputbytes )
If $inputbytes <i> 1024 And $inputbytes <b> ( 1024 * 1024 ) And $inputbytes <b> ( 1024 * 1024 * 1024 ) Then Return Round ( $inputbytes / ( 1024 * 1024 * 1024 ) , 1 ) & " Gb" EndFunc ; == >Affichage
Func maj_ud ( )
$msg = GUIGetMsg ( )
$size_file = InetGetSize ( "ftp://" & $login & ":" & $password & "@" & $siteftp & "/" & $fichierftp )
if $size_file = 0 then msgbox ( 16 , "Erreur: " , "Impossible de copier le fichier , reessayez plus tard ou telecharger le manuellement" , 10 )
InetGet ( "ftp://" & $login & ":" & $password & "@" & $siteftp & "/" & $fichierftp , "c:\fichierlocal.txt" , 1 , 1 )
info ( "Telechargement de " & $fichierftp & " - Taille: " & Affichage ( $size_file ) )
While @InetGetActive
guictrlsetdata ( $progress , Round ( @InetGetBytesRead * 100 / $size_file ) )
WEnd
guictrlsetdata ( $progress , 100 )
info ( "Fichier Téléchargé " )
EndFunc
la barre de progression ne fonctionne pas alors qu'un script équivalent marche bien sur mon serveur de boulot
en tout cas le fichier est bien téléchargé
l'important c'est la syntaxe
ftp://login:motdepasse@siteftp/dossier/fichier
voila si cela peut vous inspirer
a+ jl56