Sign in to follow this  
Followers 0
Athos

Reading from a webpage

6 posts in this topic

Hi Guys, I'm trying to find a way to collect data from a webpage using IE.

I already know about _IEBodyReadText($oIE) but the problem is, I just want a specific instance of that text without getting all of it.

What I want to be able to do, is to read that text line by line, and when I find a specific string on the line I want, I want to be able to print out that entire line.

The problem for me is that It _IEBodyReadText formats the text into one big string, so I would have to use split string to accomplish this task. The problem with that is, there are no lines, so I don't know how I would write something like,

if substring=Cluster read untill you reach .com, and let that be the substring....

Should I tackle this problem that way, or should I find a way to get the substring I want from the HTML itself?

Thanks,

Athos

Share this post


Link to post
Share on other sites



Do you have an example of the html and the text that you want? There are other _IE functions that can return specific elements of the DOM, but without knowing the specifics it is hard to recommend a solution.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Sure thing. This is from the html source (note I modded it again to protect the data)

<tr><td>&amp;nbsp;</td><td><font class="f-body">This is the body of text taht I want to avoid </font></td></tr>

<tr><td>&amp;nbsp;</td><td>

<font class="f-navbar">Cluster Host = </font><font class='f-body'>

something.com</font>

I want to get Cluster host and the something.com in 1 string. That or just the something.com would be good.

Edited by Athos

Share this post


Link to post
Share on other sites

Use function_IETableWriteToArray to retrieve the content of the table. You then can loop through the array and search for your data.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks so much water! _IETable was great, because from the array, I could just specify the column and row I wanted. :D

Edited by Athos

Share this post


Link to post
Share on other sites

Glad to be of service :D


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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
Sign in to follow this  
Followers 0

  • Similar Content

    • JustinZandee
      By JustinZandee
      I need a random string generator which creates 15 letters/numbers.
      How can I make that?
    • anthonyjr2
      By anthonyjr2
      Hi guys,
      I am pretty bad with regex, and am having some trouble trying to come up with an expression for a certain type of string. Basically I want to be able to tell if a string is of the format:
      AA#####A
      Where the A's are any letter from A-Z and the #'s are any digit from 0-9.
      I've been playing around with a regex tester online for a while but I can't really seem to grasp the concept very well. Could anyone give me any tips?
      This isn't exactly an AutoIt specific question which is why I didn't post it in General Help & Support.
    • LoneWolf_2106
      By LoneWolf_2106
      Hi everybody,
      i have a question related to strings items in an Array and sorting. Maybe someone can advice me how to solve the issue.
      I have an Array of strings, every item of the Array is as following:
      INFO [13.06.2017 11:48:01] [Thread-13] [ConGenImpUsb -> waitForConnection]  INFO [07.06.2017 08:55:44] [main] MDU5 - Ver 5.1x I want to sort the item in the array by date and time, is there any function which allows me to sort by date/time?
      Thanks in advance
    • Innominate
      By Innominate
      How can I filter out everything in a string except for text between specific tags, specifically between <title>Message title</title> and <body id="msgFeedSummaryBody" selected="false">Summary text</body>
       
      I also want to extract the URL, which is given three times:
           1. Message-Id: <https://www.linktopage.htm@localhost.localdomain>
           2. Content-Base: https://linktopage.htm (no closing tag for this, just a line feed with the next one beginning with “Content-Type: “)
           3. <base href="https://www.linktopage.htm">
       
      Having extracted the Message title, Summary text, and URL, I want to save that in one of various text files, with a prompt for user input giving me a way (such as entering a letter, word, or clicking a radio button; the latter is preferable) to specify which file.
       
      Here is the code I have so far:
       
      #include <MsgBoxConstants.au3> Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase HotKeySet("^h", "_copy") While 1 Sleep(100) WEnd Func _copy() Send("^u") ; opens the message source of the news feed in my e-mail client (Thunderbird) showing all of the desired information Sleep(1000) Send("^a") ; select all of it Sleep(1000) Send("^c") ; copy it to clipboard EndFunc Now how can I filter the clipboard contents (as above), add to it (adding “-----------------------” as a separator, display it to the screen (for confirmation), and append it as plain text to one of several different files?
       
      Thank you!
    • vikashbitm2010
      By vikashbitm2010
      Hi all,
      I want to return string from autoit script to the python code.
      Autoit:
      Exit("22 FE 45") -> not working
      Exit(1) -> Working
      Exit(0) -> Working
      python:
      import os
      res=os.system(autoitmine.exe)
      print "res",res
      I got some hint of @ExitCode macro, but dont know how to use it to get the string in python variable 'res'.
      Please resolve this issue for me if anyone knows about this.