Jump to content
esullivan

Downloading files from URLs

Recommended Posts

I am making a script, for fun, that downloads all the standard software I use when I need to reinstall my OS (A checklist if you will).  For some programs, the link will just download the newest version.  Steam for example is https://steamcdn-a.akamaihd.net/client/installer/SteamSetup.exe, which makes it really easy.  Some on the other hand use the version number in the Url like Notepad++ which is https://notepad-plus-plus.org/repository/6.x/6.8.5/npp.6.8.5.Installer.exe.

Anyone have any tips on getting around this, other than launching a browser to the download site?

 

Thanks!

Share this post


Link to post
Share on other sites
; You need the following functions:

FileReadToArray ; For getting the download links
InetGet ; To download the files in the background

TD ;)


My contributions to the AutoIt Community - ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

Share this post


Link to post
Share on other sites

Sorry, I have been using InetGet, and it works, but how would I add the url since it will change with newer versions?

Edited by esullivan
Add

Share this post


Link to post
Share on other sites
$sVersion = "6.8.5" ; Change this to adjust the version to download
$sURL = "https://notepad-plus-plus.org/repository/" & StringLeft($sVersion, 1) & ".x/" & $sVersion & "/npp." & $sVersion & ".Installer.exe"

MsgBox(0, 0, $sURL)

TD :)


My contributions to the AutoIt Community - ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

Share this post


Link to post
Share on other sites

Yea, I assumed that, but then I have to look for and adjust 10 version numbers.  Might as well go to each site and download them without a script.

Was wondering if someone had a trick.  Wildcards or something like below?

$sURL = "https://notepad-plus-plus.org/repository/" & StringLeft(*, 1) & ".x/" & * & "/npp." & $* & ".Installer.exe"

Share this post


Link to post
Share on other sites

First your url is "https://notepad-plus-plus.org/repository/"

Read that with InetRead

Parse out the last in the list which is "6.x/" so append your url

"https://notepad-plus-plus.org/repository/6.x/"

Do same for that pagr and append url

"https://notepad-plus-plus.org/repository/6.x/6.8/"

Now you can parse out the installer link from that page, but you already have all the info you need to derive

"https://notepad-plus-plus.org/repository/6.x/6.8/npp.6.8.Installer.exe"

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

×
×
  • Create New...