Jump to content

Download more file at time ?


 Share

Recommended Posts

Try this

And before anyone starts! once compiled this will still run on a computer without Autoit installed

If $CmdLine[0] > 0 then 
    Local $GetUrl, $LocalFile, $DontUseCached = 1
    
    For $i = 1 to $CmdLine[0]
        
        If StringLeft($CmdLine[$i],4) = "Get:" then $GetUrl = StringTrimLeft($CmdLine[$i],4)
        
        If StringLeft($CmdLine[$i],5) = "Save:" then $LocalFile  = StringTrimLeft($CmdLine[$i],5)
        
        If $CmdLine[$i] = "Reload:0" then $DontUseCached = 0
        
    Next
    If $GetUrl = "" then Exit
    If $LocalFile = "" then Exit
    _InetGet($GetUrl,$LocalFile,$DontUseCached)
    Exit
EndIf

_Download("http://www.bbc.co.uk/home/images/main_promo/games/doctor_who_blast_game3.jpg",@scriptDir & "\doctor_who_blast_game3.jpg")
_Download("http://www.2inept.co.uk/createdby.gif","createdby.gif")
_Download("http://www.2inept.co.uk/softpedia_clean_award_f.gif","softpedia_clean_award_f.gif")



Func _Download($Param1URL,$Param2LocalFile,$Param3NoCache = 1)
    
    If @compiled then 
        Run (FileGetShortName(@AutoItExe) &  ' "Get:' & $Param1URL & '" "Save:' & $Param2LocalFile & '"' & ' "Reload:' & $Param3NoCache & '"')
    Else
        Run (FileGetShortName(@AutoItExe) & ' /Autoit3ExecuteScript "' & @scriptName &  '" "Get:' & $Param1URL & '" "Save:' & $Param2LocalFile & '"' & ' "Reload:' & $Param3NoCache & '"')
    EndIf
    
EndFunc

Func _InetGet($URL,$FILENAME,$RELOAD)
    
    Local $iNetGet

    $iNetGet = InetGet($URL,$FILENAME,$RELOAD)
    If $iNetGet then 
        Msgbox(0 + 64 + 262144,"Download", $FILENAME & " has been downloaded successfully")
    Else
        Msgbox(0 + 64 + 262144,"Download", "Failed to download file from" & @crlf & $URL)
    EndIf
EndFunc
Link to comment
Share on other sites

Try this

And before anyone starts! once compiled this will still run on a computer without Autoit installed

If $CmdLine[0] > 0 then 
    Local $GetUrl, $LocalFile, $DontUseCached = 1
    
    For $i = 1 to $CmdLine[0]
        
        If StringLeft($CmdLine[$i],4) = "Get:" then $GetUrl = StringTrimLeft($CmdLine[$i],4)
        
        If StringLeft($CmdLine[$i],5) = "Save:" then $LocalFile  = StringTrimLeft($CmdLine[$i],5)
        
        If $CmdLine[$i] = "Reload:0" then $DontUseCached = 0
        
    Next
    If $GetUrl = "" then Exit
    If $LocalFile = "" then Exit
    _InetGet($GetUrl,$LocalFile,$DontUseCached)
    Exit
EndIf

_Download("http://www.bbc.co.uk/home/images/main_promo/games/doctor_who_blast_game3.jpg",@scriptDir & "\doctor_who_blast_game3.jpg")
_Download("http://www.2inept.co.uk/createdby.gif","createdby.gif")
_Download("http://www.2inept.co.uk/softpedia_clean_award_f.gif","softpedia_clean_award_f.gif")



Func _Download($Param1URL,$Param2LocalFile,$Param3NoCache = 1)
    
    If @compiled then 
        Run (FileGetShortName(@AutoItExe) &  ' "Get:' & $Param1URL & '" "Save:' & $Param2LocalFile & '"' & ' "Reload:' & $Param3NoCache & '"')
    Else
        Run (FileGetShortName(@AutoItExe) & ' /Autoit3ExecuteScript "' & @scriptName &  '" "Get:' & $Param1URL & '" "Save:' & $Param2LocalFile & '"' & ' "Reload:' & $Param3NoCache & '"')
    EndIf
    
EndFunc

Func _InetGet($URL,$FILENAME,$RELOAD)
    
    Local $iNetGet

    $iNetGet = InetGet($URL,$FILENAME,$RELOAD)
    If $iNetGet then 
        Msgbox(0 + 64 + 262144,"Download", $FILENAME & " has been downloaded successfully")
    Else
        Msgbox(0 + 64 + 262144,"Download", "Failed to download file from" & @crlf & $URL)
    EndIf
EndFunc
Thank you,
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...