Jump to content
Sign in to follow this  

Sequential file downloader using wget and autoit

Recommended Posts


Here's a file downloader I wrote that uses wget because I couldn't get inetget or curl to work right with my gui. You have to have wget for it to work. This script uses three input boxes on my gui, in one I type the number of files in the sequence, another box has the url of the first file, and the third is my output folder. It should work with most files and sequences. This code is basically finished, I was just wondering if anyone had any suggestions. I've only been coding for a few days now and it's very possible I'm doing something extremely stupid. There's a lot of string commands because I wanted each download batch to have a random number before the file extension.

Func downloadurl()

$wget = "C:\wget\wget.exe"
$numfiles = ControlGetText("My Gui" , "" , "Edit5") 
$inputurl = ControlGetText("My Gui" , "" , "Edit4")
$outputfolder = ControlGetText("My Gui" , "" , "Edit3")
$randomnumber = Random(200 , 1000 , 1)
$Lurl = StringLen($inputurl) ;lenghth of input url
$findslash = StringInStr($inputurl, "/", 0,-1) ;where the last slash is from the left
$findperiod = StringInStr($inputurl, ".", 0,-1); where the last period is from the left
$filenameX = StringTrimLeft($inputurl, $findslash)
$X = StringTrimLeft($inputurl, $findperiod - 1)
$LfilenameX = StringLen($filenameX)
$LX = StringLen($X)
$filenameNoX = StringTrimRight($filenameX, $LX )
$baseleech = StringTrimRight($inputurl, $LX +1) ;should be original url, - extension - 1 more number
$baseleech2 = StringTrimRight($inputurl, $LX +2)
run($wget & " "& $inputurl &" -O " & $outputfolder & "\" & $filenameNoX & $randomnumber + 1 & $X)
for $b = 2 to $numfiles 
run($wget & " "& $baseleech & $b & $X & " -O " & $outputfolder & "\" & $filenameNoX & $randomnumber + $b & $X)
if $b > 8 and $filenameNoX = "1" then $baseleech = $baseleech ; only works for 1-99
if $b > 8 and $filenameNoX <> "1" then $baseleech = $baseleech2 ;only works for 01-99
run("explorer.exe" & " " & $outputfolder)


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.