darzanmihai Posted January 13, 2010 Share Posted January 13, 2010 I need some help collecting some information from the table "Today's Calendar " from www.forexfactory.com Could someone help me please? Thx in advance 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 More sharing options...
PsaltyDS Posted January 13, 2010 Share Posted January 13, 2010 Help with what? What have you tried? What happened when you tried it? 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 More sharing options...
darzanmihai Posted January 13, 2010 Author Share Posted January 13, 2010 Help with what? What have you tried? What happened when you tried it? okI 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 replyI 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 More sharing options...
PsaltyDS Posted January 13, 2010 Share Posted January 13, 2010 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. 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 More sharing options...
darzanmihai Posted January 13, 2010 Author Share Posted January 13, 2010 Thx for help. It did the job. 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 More sharing options...
darzanmihai Posted January 13, 2010 Author Share Posted January 13, 2010 Sorry to disturb again... How could I get the details for each row (on the detail column)? 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 More sharing options...
PsaltyDS Posted January 13, 2010 Share Posted January 13, 2010 What kind of details? And do you mean from the array you already got, or from the TR elements in the actual table? 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 More sharing options...
darzanmihai Posted January 14, 2010 Author Share Posted January 14, 2010 What kind of details? And do you mean from the array you already got, or from the TR elements in the actual table?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 More sharing options...
PsaltyDS Posted January 14, 2010 Share Posted January 14, 2010 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. 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 More sharing options...
darzanmihai Posted January 14, 2010 Author Share Posted January 14, 2010 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.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 More sharing options...
darzanmihai Posted January 14, 2010 Author Share Posted January 14, 2010 I found a way of doing what I needed in the last post: expandcollapse popup#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 More sharing options...
PsaltyDS Posted January 14, 2010 Share Posted January 14, 2010 (edited) 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. 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. Edit: Oops. Should be .id, not .uniqueId. Edited January 15, 2010 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 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