Jump to content

IE.au3 ---> ForexFactory.com --


Recommended Posts

Help with what? What have you tried? What happened when you tried it?

:D

ok

I used the debug bar and I saw that the information I try to extract is not in a form but in a table so I managet just to get the number of tables from the page...but I do not know what to do next since there are just 2 table functions...

Thx for reply

I could really need some help on this

I do not like stupid and idiot people that write idiot things...If you are one, do not write.

Link to comment
Share on other sites

Get an object reference to the table you want with _IETableGetCollection(). If there are only two, an index of 0 = first table, and 1 = second.

Get the data as a first experiment with _IETableWriteToArray() and view the resulting array with _ArrayDisplay().

Drilling in further to the table will require some learning curve about the DOM, table row <TR> and table data <TD> tags, and what you want from inside them.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

What kind of details? And do you mean from the array you already got, or from the TR elements in the actual table?

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

What kind of details? And do you mean from the array you already got, or from the TR elements in the actual table?

:D

From the TR elements. There is a button in the table for each row. When you press that button it will pop a smaller window with some details about that specific row. I would like to grab that information for each row, but I don't know how.

Thax again

I do not like stupid and idiot people that write idiot things...If you are one, do not write.

Link to comment
Share on other sites

Time to climb the learning curve. Get yourself a copy of DebugBar (a common 'DOM Inspector') installed and start looking at the DOM and how those <button> or <input> tags are formatted.

Do they have ID or name attributes? If so, they can be addressed very simply and directly. If not, there are other work-arounds.

It's worth learning and very useful once you start understanding it.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Time to climb the learning curve. Get yourself a copy of DebugBar (a common 'DOM Inspector') installed and start looking at the DOM and how those <button> or <input> tags are formatted.

Do they have ID or name attributes? If so, they can be addressed very simply and directly. If not, there are other work-arounds.

It's worth learning and very useful once you start understanding it.

:D

Thx again for the reply.

I attached a screenshot of the tables I am talking about:

1- the details about each row - it is a button with an id (found with DebugBar) but I think it will change in time because the data from the table changes weekly.

When you press the "details" button it will popup a window (3) on top of the firs one, and the initial button turns into (2)- with the same id - so you can close the popup window.

I am interested in collecting the information from the table (4) of the popup window - I managed to do this from Autoit (up to this point), but there is a BUT:

- Knowing that the "details" buttons have dinamic IDs how could I get all the IDs from that column, and to know from what row is that ID?

I do not like stupid and idiot people that write idiot things...If you are one, do not write.

Link to comment
Share on other sites

I found a way of doing what I needed in the last post:

#include <IE.au3>
#include <array.au3>
#include <String.au3>

$oIE = _IECreate("www.forexfactory.com/calendar.php", 0, 1)
_IELoadWait($oIE)

$oTable = _IETableGetCollection($oIE)
$iNumTables = @extended

$colection = _IETableGetCollection($oIE, 9)
;$tables = _IETableWriteToArray($colection, 1)
;_ArrayDisplay($tables)

$Tbl_html = _IEDocReadHTML($colection)
$res_arr = _StringBetween($Tbl_html, "<TR id=detail_row_seek_", ">")

For $i = 0 To UBound($res_arr) - 1
    $Detail_id = "detail_" & $res_arr[$i]
    $detail_butt = _IEGetObjById($colection, $Detail_id);"detail_load_25550"
    $detail_butt.click
    $ok = wait_for_new_table($oIE, $iNumTables);1- ok , 0 - fail
    If $ok = 1 Then  ;if the popup window opens 
        ;$oTable_new = _IETableGetCollection($oIE)
        ;$iNumTables_new = @extended
        ;$colection_new = _IETableGetCollection($oIE, 13)
        ;$tables_new = _IETableWriteToArray($colection_new, 1)
        ;_ArrayDisplay($tables_new)
    EndIf
    Sleep(500)
    $detail_butt.click
Next

Func wait_for_new_table($oIE, $iNumTables);if the number of tables in the page changes then it means that the popup window opened
    $c = 1
    $sleep = 500
    While $c * $sleep <= 60000
        $oTable_n = _IETableGetCollection($oIE)
        $iNumTables_n = @extended
        If $iNumTables <> $iNumTables_n Then 
            Return 1
            ExitLoop
        EndIf
        $c += 1
        Sleep($sleep)
    WEnd
    Return 0
EndFunc   ;==>wait_for_new_table

, but I stil have a question: How could I get the index of the new table opened in the page?...I mean without searching all the tables in that page and identifying the one I am looking for (this is labour intensive...for the PC)

Do you have any ideea?

Thx again

I do not like stupid and idiot people that write idiot things...If you are one, do not write.

Link to comment
Share on other sites

You can use _IETableGetCollection() with an index to get the 1st, 2nd, 3rd, etc. table. For example, _IETableGetCollection($oForm, 1) would get the second (0-based) table.

Then use _IETagNameGetCollection() to get to the right table row "TR" tag, and as required get the data cell "TD" tag(s) under that, etc.

Eventually, you will drill down to what you want.

Start coding on it and see how it goes. When you get stuck, post your code for more help.

:D

Edit: Didn't see your previous reply while typing this one. You can get a collection of all tables with _IETableGetCollection($oIE, -1), then loop through them and save an array or string of all the IDs:

$sTableIDs = ""
$colTables = _IETableGetCollection($oIE, -1)
For $oTable In $colTables
    $sTableIDs &= $oTable.id & ";"
Next
When you see the count of tables change, you do it again and find the one whose .id was not previously listed.

:huggles:

Edit: Oops. Should be .id, not .uniqueId.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...