karudish

Should i learn another language to automate this?

2 posts in this topic

#1 ·  Posted (edited)

Hi, I'm currently working on a study about the football betting market, and i would like to automatize some of the process of getting data into my databases (excels for example).

The problem here is i only know AutoIT as a programming language.

~Example of 1 task i wanted to do:

Open this (http://www.meusresultados.com/equipa/real-madrid/W8mj7MDD/); Get Real Madrid's last game goals; Store into a variable then Excel;

In this example i would use maybe _FFReadHTML and _StringBetween, but in this case some of the source code is hidden in a thing called "<div id"

So, people in this forum seem to understand a little bit more.. What language should i learn to facilitate my job?

Regards,

Edited by karudish

Share this post


Link to post
Share on other sites



#2 ·  Posted

Does this work for you?

#include <Array.au3>
#include <IE.au3>

Local $aUltimos_Resultados = _GetResults("http://www.meusresultados.com/equipa/real-madrid/W8mj7MDD/", "fs-summary-results")
    _ArrayDisplay($aUltimos_Resultados)
Local $aAgendados = _GetResults("http://www.meusresultados.com/equipa/real-madrid/W8mj7MDD/", "fs-summary-fixtures")
    _ArrayDisplay($aAgendados)
Local $aEquipa = _GetResults("http://www.meusresultados.com/equipa/real-madrid/W8mj7MDD/", "block-summary-squad")
    _ArrayDisplay($aEquipa)

Func _GetResults($sURL, $sTableId)
    Local $aTable, $aUnique
    Local $oIE = _IECreate($sURL, 1)
    _IELoadWait($oIE)
    Local $oDivs = _IEGetObjById($oIE, $sTableId)
    Local $oTables = _IETagNameGetCollection($oDivs, "table")
    For $oTable in $oTables
        $aTable = _IETableWriteToArray($oTable, True)
    Next
    If UBound($aTable) > 1 Then
        For $i = UBound($aTable, 2) - 1 To 0 Step - 1
            ConsoleWrite($i & @CRLF)
            $aUnique = _ArrayUnique($aTable, $i)
            If $aUnique[0] = 1 And StringStripWS($aUnique[1], 8) = "" Then _ArrayColDelete($aTable, $i)
        Next
    Else
        Local $aTable[1][2] = [[0, ""]]
    EndIf
    Return $aTable
EndFunc

 

Share this post


Link to post
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