Jump to content
Sign in to follow this  
quentin44

Donwload with HttpSetProxy

Recommended Posts

quentin44

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.

Share this post


Link to post
Share on other sites
FireFox

Hi,

Welcome to the autoit forum :)

Put the HttpSetProxy function at the top of your script/before any Inet function and it should do the trick.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
quentin44

Ok, so just put : HttpSetProxy(1) on the top of my script and that's ok? Or i declare a function -> func HttpSetProxy(2) EndFunc?

Sorry but i started ( even if that's a easy language ^^)

Share this post


Link to post
Share on other sites
FireFox

It depends on what you want to do.

Please read the help file for this function.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
quentin44

I read the help file but i don't understand ! otherwise i don't write the Subject. I search just the operation of this function, if i'm put just a line or put a function.

I'm very sorry for the disturb but I need this information that's all.

My words are not bad but I started with this language. I just want to know where to put the HttpsetProxy and if we just let the line or if we made ​​a dedicated function. I just need it! I do not ask you to do me but that I needle. I'm sorry to bother you again for such a thing.

I'll manage, have a good day (or night ^^) :)

Quentin.

Edited by quentin44

Share this post


Link to post
Share on other sites
FireFox

Quand j'ai dit ça dépend de ce que tu veux faire, c'est parce qu'il y a 3 options possibles avec la fonction HttpSetProxy par son paramètre qui est un drapeau.

Tu veux spécifier un proxy avec une adresse ou bien choisir le proxy qui est dans les options d'internet explorer?

When I said it depends on what you want to do, that's because there is 3 possible options with the function HttpSetProxy by its parameter which is a flag.

You want to specify a proxy with an address or to choose the proxy which is in the IE settings?

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
quentin44

Je veut spécifier un proxy, mais du coup je laisse juste le HttpSetProxy(2, "www-cache.myisp.net:8080")

ou je doit développé plus en détails?

I want to specify a proxy, but suddenly I just let the HttpSetProxy(2, "www-cache.myisp.net:8080") or must I developed in more detail?

Share this post


Link to post
Share on other sites
FireFox

Correct, if there is no authentication.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
quentin44

Ok, thank's ;)

Edited by quentin44

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.