Jump to content

How to capture text using AutoIT?


Recommended Posts

Referring to following image, I would like to know on how to export row 0 into text file as well.

Do you have any suggestions?
Thanks, to everyone very much for any suggestions (^v^)

 

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

$oIE = _IECreate("https://www.cmegroup.com/trading/interest-rates/countdown-to-fomc.html")
_IENavigate($oIE, "https://cmegroup-tools.quikstrike.net/User/QuikStrikeView.aspx?viewitemid=IntegratedFedWatchTool")

$oTag = _IEGetObjById ($oIE, "ctl00_MainContent_ucViewControl_IntegratedFedWatchTool_uccv_lvMeetings_ctrl3_lbMeeting")
_IEAction ($oTag, "click")
_IELoadWait ($oIE, 5000)

$oTable = _IETableGetCollection($oIE, 4)
;$oTable = _IETableGetCollection($oIE,0)
$aData = _IETableWriteToArray($oTable)
_ArrayDisplay($aData)
_FileWriteFromArray("C:\temp\txt.txt" , $aData,1)

 

export.png

Link to comment
Share on other sites

Referring to following image, I would like to know on how to retrieve the date as shown below, there is no date information within arraydisplay.

Do you have any suggestions?

Thanks, to everyone very much for any suggestions (^v^)

 

Date.png

Date2.png

Edited by oemript
Link to comment
Share on other sites

Please see following coding as shown below.

Do you have any suggestions?
Thanks, to everyone very much for any suggestions (^v^)

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

$oIE = _IECreate("https://www.cmegroup.com/trading/interest-rates/countdown-to-fomc.html")
_IENavigate($oIE, "https://cmegroup-tools.quikstrike.net/User/QuikStrikeView.aspx?viewitemid=IntegratedFedWatchTool")

$oTag = _IEGetObjById ($oIE, "ctl00_MainContent_ucViewControl_IntegratedFedWatchTool_uccv_lvMeetings_ctrl3_lbMeeting")
_IEAction ($oTag, "click")
_IELoadWait ($oIE, 5000)

$oTable = _IETableGetCollection($oIE, 4)
;$oTable = _IETableGetCollection($oIE,0)
$aData = _IETableWriteToArray($oTable)
_ArrayDisplay($aData)
_FileWriteFromArray("C:\temp\txt.txt" , $aData,1)

 

Link to comment
Share on other sites

@oemript  At the stage you are now, you should be able to resolve this very small problem by yourself.  When there is text at the end of a tag, it is called .innertext.  You already got the object in $oTag.  So just save the text into a variable and write it to the file or copy it somewhere in the array (there is empty spaces) before you write the array to the file.

 

Link to comment
Share on other sites

I try following coding, but it displays nothing within dialog box.

MsgBox($MB_SYSTEMMODAL, "InnerText",$oTag.InnerText)

Do you have any suggestions on how to retrieve innerText properly?
Thanks, to everyone very much for any suggestions (^v^)

 

Link to comment
Share on other sites

When I search for help with " text " or " textContent", there is no related function for AutoIT.

Could you please provide any example on how to do that?

Do you have any suggestions?
Thanks, to everyone very much for any suggestions (^v^)

Link to comment
Share on other sites

I try following approach without luck

MsgBox($MB_SYSTEMMODAL, "InnerText", _IEPropertyGet($oTag, "innertext"))
MsgBox($MB_SYSTEMMODAL, "InnerText", $oTag.innertext)
MsgBox($MB_SYSTEMMODAL, "InnerText", $oTag.text)

Do you have any suggestions on what is the proper format to retrieve innertext?
Thanks, to everyone very much for any suggestions (^v^)

 

Link to comment
Share on other sites

Tested it with both .text AND .innerText and both are working fine.  But you need to grab it BEFORE you click on it, because the context changes after the click.  Really you need to experiment a minimum when we tell you something, it wasn't so hard to find ...

Edited by Nine
Link to comment
Share on other sites

32 minutes ago, oemript said:

ERROR Message

--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (ctl00_MainContent_ucViewControl_IntegratedFedWatchTool_uccv_lvMeetings_ctrl6_lbMeeting)
"D:\Sample.au3" (13) : ==> Variable must be of type "Object".:
MsgBox($MB_SYSTEMMODAL, "Text : ", $i & " : " & $oTag.text)
MsgBox($MB_SYSTEMMODAL, "Text : ", $i & " : " & $oTag^ ERROR

Have you tried using IsObj()? That seems like an obvious choice to me. 🤨

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