Sign in to follow this  
Followers 0
About_Nothing

InetGet problem

3 posts in this topic

Hi all,

I am trying to create an internet file downloader. I've just started with the progressbar for testing.

It works fine for the files from internet..)

However it doesn't work for the files from local computer( I am using Apache server running on my PC )

I've created it for testing sake. Whenever I download the file from local computer the script gets frozen ;)

I have no clue how to fix it.. :D

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>


$address_URL = "http://localhost/newfile_3.mp3"; it doesn't work on localmachine..

Func Example()
    
    Local $msg
    GUICreate("Downloader",300,100,@DesktopWidth/2 -150 ,@DesktopHeight/2 - 50 )  
    $progress_download = GUICtrlCreateProgress(10, 10, 200, 20,$PBS_SMOOTH)
    $button_start= GUICtrlCreateButton ("stahuj",10,40,60,25)
    $label_progress = GuictrlCreatelabel("",10,70,400,30)
    
    GUISetState(@SW_SHOW)      
    
    While 1
        $msg = GUIGetMsg()
        
        if $msg=$button_start Then
            
            InetGet($address_URL,@DesktopDir & "\music.mp3", 1, 1)
            $size = InetGetSize($address_URL)
            
            While @InetGetActive
                $BytesRead=@InetGetBytesRead
                GuiCtrlSetData($label_progress,$BytesRead & "bytes of " & $size)
                $percentage=($BytesRead/$size)*100
                GuiCtrlSetData($progress_download,$percentage)
                sleep(50)
            WEnd
            
            GuiCtrlSetData($label_progress,"DONE.")
        EndIf
            
        If $msg = -3 Then ExitLoop
        
    WEnd
    
        GUIDelete()
    EndFunc 
    
Example()

Share this post


Link to post
Share on other sites

The Apache server probably isn't configured to listen on IP address 127.0.0.1. If you use the network adapter's IP address it will work just fine.

Share this post


Link to post
Share on other sites

It works.. >_<

Thanks a lot! :)

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  
Followers 0