gcue Posted July 31, 2009 Share Posted July 31, 2009 (edited) im trying to write a script that automates the download of an update. problem is that the filename changes and on rare occassion the link may change (so id want to error out or give the script runner the option of clicking on new link) planning on using inetget. http://about.bloomberg.com/contact_softwaresupport_upgr_html.html Edited July 31, 2009 by gcue Link to comment Share on other sites More sharing options...
gcue Posted July 31, 2009 Author Share Posted July 31, 2009 actually they have an index site! ill look at the file dates and find the newest file with string upgr* hmm never worked with html reading but ill try it out! Link to comment Share on other sites More sharing options...
zorphnog Posted July 31, 2009 Share Posted July 31, 2009 You could always just parse the source code to find the link. expandcollapse popup#include <INet.au3> ; Get Software Update page source $sHTML = _INetGetSource("http://about.bloomberg.com/contact_softwaresupport_upgr_html.html") If @error Then ConsoleWrite("Error downloading source page" & @LF) Exit EndIf ;Parse Bloomberg Application paragraph section $aResult = StringRegExp($sHTML, "(?i)(?s)(?U:<p><strong>Bloomberg Application.+</p>)", 3) If @error Then ConsoleWrite("Error parsing Bloomberg Application paragraph" & @LF) Exit EndIf $sBAParagraph = $aResult[0] ;Parse version information $aResult = StringRegExp($sBAParagraph, "(?i)\((.+)\)", 3) If @error Then ConsoleWrite("Error parsing version information" & @LF) Exit EndIf $sVersionInfo = $aResult[0] ;Parse download hyperlink $aResult = StringRegExp($sBAParagraph, '(?i)(?U)<a.+"(.+)"', 3) If @error Then ConsoleWrite("Error parsing download hyperlink" & @LF) Exit EndIf $sDLLink = $aResult[0] ;Display Info $iReturn = MsgBox(0x24, "Available Download: Bloomberg", StringFormat("Application Name:\tBloomberg Application\r\nVersion Info:\t%s\r\nDownload Link:\t%s\r\n\r\nDownload the update?", $sVersionInfo, $sDLLink)) ;Download File If $iReturn = 6 Then ProgressOn("Bloomberg Application update", "Download in progress...") $iSize = InetGetSize($sDLLink) $iReturn = InetGet($sDLLink, @DesktopDir & "\BloombergUpdate.exe") If $iReturn = 0 Then MsgBox(4096, "Error", "Download failed!") Exit EndIf While @InetGetActive = 1 ProgressSet(@InetGetBytesRead / $iSize * 100) Sleep(100) WEnd ProgressOff() EndIf Link to comment Share on other sites More sharing options...
gcue Posted August 1, 2009 Author Share Posted August 1, 2009 awesome!!!!!! many thanks very interesting way of doing it.. hehe alot cleaner than what i was gonna do.. Link to comment Share on other sites More sharing options...
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