Jump to content

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!

Link to comment
Share on other sites

; You need the following functions:

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

TD ;)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
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 :)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
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"
Link to comment
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"

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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...