Jump to content

downloading bloomberg update


Recommended Posts

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 by gcue
Link to comment
Share on other sites

You could always just parse the source code to find the link.

#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

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