WIZ-TABLES01.ALT

This is an OutWit Tutorial file.


Testing Browser...
OutWit Hub Pro - Extracting Tables (1)
Application walkthrough: using base extractors
userSpace.setWizardPrefs = function setWizardPrefs(){ wizardKit.setWizardPref("browse.tempo.min", "2000"); wizardKit.setWizardPref("browse.tempo.max", "3500"); wizardKit.setWizardPref("images.ondemandonly", false); // witscript.setPreference("page.ignorePlugins", false); wizardKit.setWizardPref("page.ignoreImages", false); wizardKit.setWizardPref("tableMinRows", "1"); //alert(witscript.getPreference("DOMSourceDontWarn")); wizardKit.setWizardPref("DOMSourceDontWarn", true); //alert(witscript.getPreference("DOMSourceDontWarn")); }


A Simple Table Extraction


While this window is showing instructions, the user interface of OutWit Hub remains operational.

You can still interact normally with the application and you can move this tutorial window around on the screen to better see the parts of the interface that you want.

userSpace.eyeCatcherOK = !(wizardKit.platform=="mac" && /firefox/i.test(navigator.userAgent) && /rv:1[2-7]/i.test(navigator.userAgent)); if (/Firefox\/[23]\./.test(navigator.userAgent)){ alert("OutWit wizards cannot run on your version of Firefox. Please update to the current version and try again."); wizard.close(); } else if (!("witscript" in window) || !witscript.version || !witscript.version("3")){ alert("This wizard is not compatible with your version of the OutWit Kernel. Please download the latest version (2.0.1 or higher)"); wizard.close(); } if(witscript.version("3")){$(".owui-wizard-homelink").html("Hub Tutorials")}; wizardKit.hideCatch(); wizardKit.hideLog(); if(!(/work\/wikipedia\/List_of_highest-grossing_films_by_year/.test(witscript.toolbar.urlBar.getValue()))){ witscript.views.page.load("http://www.outwit.com/support/help/hub/tutorials/work/wikipedia/List_of_highest-grossing_films_by_year.html"); } //userSpace.storeOriginalPrefs(); userSpace.setWizardPrefs(); witscript.logPanel.setAttribute("height",0);
wizardKit.say(this.parentNode); witscript.views.page.display();
wizardKit.say(this.parentNode); wizardKit.hideCatch(); wizardKit.hideLog(); if(!(/work\/wikipedia\/List_of_highest-grossing_films_by_year/.test(witscript.toolbar.urlBar.getValue()))){ witscript.views.page.load("http://www.outwit.com/support/help/hub/tutorials/work/wikipedia/List_of_highest-grossing_films_by_year.html"); } witscript.views.page.display(); witscript.menutree.focus(); witscript.views.page.browser.scrollToPercent(0);


All-Time Box-Office

This is a copy of the wikipedia page about the highest grossing films of all times.

Scrolling down this page, we find an HTML table with the Top Films in terms of revenu since 1915.

wizardKit.say(this.parentNode); wizardKit.hideCatch(); wizardKit.hideLog(); if(!(/work\/wikipedia\/List_of_highest-grossing_films_by_year/.test(witscript.toolbar.urlBar.getValue()))){ witscript.views.page.load("http://www.outwit.com/support/help/hub/tutorials/work/wikipedia/List_of_highest-grossing_films_by_year.html"); } witscript.views.page.display(); witscript.menutree.focus(); for(var i = 0.0; i < 2.6; i += 0.1){ //alert(Object.keys(views.page)); witscript.views.page.browser.scrollToPercent(i); witscript.wait(50); } page.findBar.textbox.setValue("High-grossing films by year of release"); witscript.menutree.focus(); witscript.wait(300); page.findBar.textbox.setValue("");

Let's extract this data.

wizardKit.say(this.parentNode); witscript.views.tables.exportPreview.setAttribute("width",100) witscript.views.tables.previewSplitter.collapseAfter() witscript.views.tables.exportPreview.exportType.setValue("excel") witscript.views.tables.display(); witscript.menutree.focus();

Simply click on 'tables' in the left side panel.

wizardKit.say(this.parentNode); witscript.views.tables.exportPreview.setAttribute("width",100) witscript.views.tables.previewSplitter.collapseAfter() witscript.views.tables.exportPreview.exportType.setValue("excel") witscript.views.tables.display(); witscript.menutree.focus();

And that's it. The data is ready to be exported.

wizardKit.say(this.parentNode); witscript.views.tables.previewSplitter.uncollapse() witscript.views.tables.exportPreview.exportType.setValue("excel") witscript.views.tables.exportPreview.setAttribute("width",400) wizardKit.resize(views.tables.exportPreview, "width", 15, 2,100,true); //wizardKit.eyeCatcher(views.links.exportPreview.layoutRenderer,1,1,0,0); witscript.wait(2000); witscript.views.tables.exportPreview.exportType.setValue("csv") //wizardKit.eyeCatcher(views.links.exportPreview.layoutRenderer,1,1,0,0); witscript.wait(1500); witscript.views.tables.exportPreview.exportType.setValue("html")

The export preview panel displays the extracted data as it will be exported in the format that you select in the top left menu.

Try saving an export file on your hard disk in the format you prefer.

//alert(userSpace.WTI); wizardKit.say(this.parentNode); // wizardKit.restoreOriginalPrefs(); // XXX JC: This should not be here. Move to the close button (or event) witscript.menutree.focus(); $(".owui-wizard-homelink").attr("style","color: #DFFFF9 !important; float:left;").html("More Tutorials");


In most cases, it's that simple.

As with all built-in extractors of OutWit Hub, a single click is usually enough. To see how to extract a table from pages containing multiple tables (which is not much more difficult), please look at the second Table Extraction tutorial.

With these functions and the many others you will find in the help center, you can feed excel spreadsheets, databases or websites with readily usable data.