Jump to content

Recommended Posts

Posted

Would it be possible to load the values from a combo box on a web page into a combo box on my GUI?.

I think it may be possible with one of the IE.au3 functions but I don't understand them and I would like to do it without starting a browser. I have been trying to do it by downloading the web page and parsing the source for the correct text using StringRegExp and have come to some basterdized affair that I could work with but randomly the web page does not seem to download fully.

The web page is Here and the string I am trying to clean up is

value="ar">Arabic</option><option value="bg">Bulgarian</option><option value="zh-hk">Chinese (Hong Kong SAR)</option><option value="zh-cn">Chinese (Simplified)</option><option value="zh-tw">Chinese (Traditional)</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en" selected>English</option><option value="et">Estonian</option><option value="fi">Finnish</option><option value="fr">French</option><option value="de">German</option><option value="el">Greek</option><option value="he">Hebrew</option><option value="hi">Hindi</option><option value="hu">Hungarian</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="ko">Korean</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="no">Norwegian (Bokmål)</option><option value="pl">Polish</option><option value="pt-br">Portuguese (Brazil)</option><option value="pt-pt">Portuguese (Portugal)</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sr">Serbian (Latin)</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option value="es">Spanish</option><option value="sv">Swedish</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian

What I want to end up with is just the Language names, Arabic, Bulgarian etc in a delimited string so it can be manipulated. My best effort so far is
#include <file.au3>
#include <string.au3>

Local $URL = 'http://www.microsoft.com/downloads/details.aspx?FamilyID=1B0BFB35-C252-43CC-8A2A-6A64D6AC4670&displaylang=en'
Local $HTM = 'C:\KB.htm'
Local $aArray

InetGet($URL, $HTM)
_FileReadToArray($HTM, $aArray)

For $i = 1 To $aArray[0]
    $cnt = StringInStr($aArray[$i], 'java script:setChangeLanguageButtonState(this)')
    
    If $cnt Then 
        $string = _StringBetween($aArray[$i], '<option ', '</option></select>')
        $string[0] = StringRegExpReplace($string[0], '</option><option |value="|">', '|')
    EndIf
Next

MsgBox(0,'', $string[0])
FileDelete($HTM)

Any help with the StringRegExp part or a method to use the IE.au3 functions on the downloaded file (is that possible?.) would be appreciated.

Thanks

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