Extract Table and Extract Table By Name Examples Needed

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
tjorgens
Newbie
Posts: 3
Joined: Fri Oct 14, 2011 6:50 am
Location: Poulsbo, Washington

Extract Table and Extract Table By Name Examples Needed

Post by tjorgens » Tue Nov 01, 2011 8:23 am

I have been creating some scripts using Macro Scheduler and Web Recorder to capture several web pages.

In most of my scripts I have been able to figure out how to save a off-line copy of a web page, use image recognition to capture a portion of the web page and use the Extract Tag function to capture the text on a webpage that had over 400 tags.

My problem occurred the other night when my script blew up when the web site I was using changed their format and suddenly the elements I was capturing no longer existed.

I did some poking around in the Web Recorder help and found that there are two additional functions that will make my coding much simpler. These are Extract Table and Extract Table By Name. I cannot, however, figure out any way to highlight tables in Web Recorder with a tool similar to the Tag Extractor. I have not been able to record these to functions in action and I have been unable get the functions to work in Macro Scheduler. The help files are also quite minimal on these to functions. There are no suitable examples in the forums on this site.

Can you post some examples of these functions in action? I see these functions holding the power to reduce my 46 page script that captured a table with 419 cells to a simple 4 or 5 lines of code.

Having some code that I can cut and paste and experiment with should enable me to get back on the road to productivity.

Thanks for the help and the great product.
Troy Jorgens
Poulsbo, Washington

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

Post by Marcus Tettmar » Tue Nov 01, 2011 1:26 pm

There is an example in the WebRecorder help file.

Try this script. It goes to our version comparison page and extracts the table to a CSV file:

Code: Select all

IE_Create>0,IE[0]

IE_Navigate>%IE[0]%,www.mjtnet.com/version_matrix.htm,r
IE_Wait>%IE[0]%,r
Wait>delay

IE_Wait>%IE[0]%,r
Wait>delay

IE_ExtractTable>%IE[0]%,,0,%SCRIPT_DIR%\table.csv,1,r
You can use the Tag Extraction Wizard to help you determine the index number of the table if you are not comfortable looking at the HTML source.

Look at the source of the HTML and find the table tag. See if it has an ID or NAME attribute. If so you can use ExtractTableByName. If not you need to rely on the index (i.e. the first table is 0, and so on).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

tjorgens
Newbie
Posts: 3
Joined: Fri Oct 14, 2011 6:50 am
Location: Poulsbo, Washington

Post by tjorgens » Fri Nov 04, 2011 7:37 am

Thanks. This code works great. I am off and running again.
Troy Jorgens
Poulsbo, Washington

DAY3
Newbie
Posts: 7
Joined: Mon Nov 28, 2011 5:46 pm
Location: Atlanta, Georgia USA

..

Post by DAY3 » Wed Jan 04, 2012 3:20 am

..

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