esullivan Posted October 24, 2015 Posted October 24, 2015 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!
TheDcoder Posted October 24, 2015 Posted October 24, 2015 ; You need the following functions: FileReadToArray ; For getting the download links InetGet ; To download the files in the backgroundTD 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
esullivan Posted October 24, 2015 Author Posted October 24, 2015 (edited) Sorry, I have been using InetGet, and it works, but how would I add the url since it will change with newer versions? Edited October 24, 2015 by esullivan Add
TheDcoder Posted October 25, 2015 Posted October 25, 2015 $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
esullivan Posted October 25, 2015 Author Posted October 25, 2015 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"
AutoBert Posted October 25, 2015 Posted October 25, 2015 May be a donwload (with INetGet etc.) of the websites and a RegEx helps to find the correct URL's.
TheDcoder Posted October 25, 2015 Posted October 25, 2015 @esullivan ¯\_(ツ)_/¯ 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
JohnOne Posted October 25, 2015 Posted October 25, 2015 First your url is "https://notepad-plus-plus.org/repository/"Read that with InetReadParse 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.
esullivan Posted October 25, 2015 Author Posted October 25, 2015 Thanks JohnOne, Can you give example code for that? Just one is good.Is it possible to read url source code without opening the site in a browser? In the source for http://www.videolan.org/vlc/download-windows.html if I could search for "Download latest VLC -" I could get the text just after that?
esullivan Posted October 25, 2015 Author Posted October 25, 2015 I found this from here https://www.autoitscript.com/forum/topic/133330-read-a-webpages-source-code-and-assign-to-variable/#Include <String.au3> #include <INet.au3> $s_URL = "http://omegle.com/" $source = _INetGetSource ($s_URL) $url = _StringBetween($source, '<frame src="', '"') MsgBox(0, "out", $url[0])Trying to get it to work now
esullivan Posted October 25, 2015 Author Posted October 25, 2015 This code works:#Include <String.au3> #include <INet.au3> $s_URL = "http://www.videolan.org/vlc/download-windows.html" $source = _INetGetSource ($s_URL) $url = _StringBetween($source, '<h1>Download latest VLC - ', '</h1>') MsgBox(0, "out", $url[0])
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now