Extracting specific HTML or Text Data

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Noerty
Newbie
Posts: 3
Joined: Sat Aug 15, 2015 1:30 pm

Extracting specific HTML or Text Data

Post by Noerty » Sat Aug 15, 2015 1:46 pm

Good day,

I am fairly new to macro scheduler or scripting in general. I wrote a first script which captures information from a website and pastes it into excel which was simple and saved me a hell lot of work.
The same I want to do now, however the information I am looking for is a lot of text. It is so much text that I would need to scroll the window during capturing in order to get the text.

Therefore using XY mouse positions relative to window doesn't work. Since I am re- using that information in HTML format I thought about accessing the html data of the webpage. Which works very easy. But how do I now delete the rows of data that are not interesting for me?

I thought about finding a row that marks the beginning and end of interesting information and delete everything outside these borders. I hope that makes sense. I just don't know how to do that.

The operation has to be done 1000 times. That's why I need a script for that workflow.

Thank you very much for your thoughts.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Extracting specific HTML or Text Data

Post by Marcus Tettmar » Sat Aug 15, 2015 9:25 pm

Rather than see it as deleting the lines you don't want we would usually look at extracting the part we DO.

I would usually use RegEx. There should be a pattern - maybe a token, or tag or word - some pattern - which marks the start and end of the block of text I want. I would then use a RegEx pattern.

Have a look at this article:
http://help.mjtnet.com/article/12-my-most-used-regex

Alternatively use the string functions Position and MidStr or even Separate.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts