SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Jul 2007
    Posts
    13
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    vbscript for fetching data from html to xls

    i have a site foxsports.com->mlb->scores->boxscores->there is score board with batter,game, and season in a grid (HTML).
    i want to fetch this HTML data to excel sheet by using vbscript or Java script.
    this is my current task.plz help me in doing this.

    also tell me whether Test complete tool supports web based applications or not?

    Thanx and Regards,
    Krishna Prasad Arni(GTL)

  2. #2
    Senior Member
    Join Date
    May 2004
    Posts
    1,196
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: vbscript for fetching data from html to xls

    Hi Krishna,

    We will try to create a sample script for you. We'll post it here once it is ready.
    Best regards,
    David - SmartBear Support

  3. #3
    Senior Member
    Join Date
    May 2004
    Posts
    1,196
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: vbscript for fetching data from html to xls

    Hi Krishna,

    Here is the sample script demonstrating how you can do this:

    <font class="small">Code:</font><hr /><pre>// JScript
    function Main()
    {
    var prTable = Sys.Process("IEXPLORE");
    var w = prTable.Window("IEFrame", "*", 1).Window("Shell DocObject View", "", 1).Window("Internet Explorer_Server", "", 1);
    var page = w.ToURL("http://msn.foxsports.com/mlb/boxscore?gameId=270710132");
    page.Wait();
    var obj = page.document.all.FindChild("innerText", "*AL All-Stars*");
    var wTable = page.document.all.Item(obj.Id + 1)
    SaveInternetTable(wTable, "c:\\iTable.xls");
    }

    function SaveInternetTable(InternetTable, FileName)
    {
    if (InternetTable.tagName == "TABLE")
    {
    var ExcelObject = Sys.OleObject("Excel.Application");
    ExcelObject.Visible = true;
    ExcelObject.WorkBooks.Add;
    var CurrentBook = ExcelObject.WorkBooks(1);
    var CurrentSheet = CurrentBook.WorkSheets(1);
    CurrentSheet.Name = "Internet table";
    var NumberCell = 0;
    var RowCount = InternetTable.rows.length;
    var ObjectRow = InternetTable.rows[0];
    for (var RC = 0; RC &lt; RowCount; RC++)
    {
    ObjectRow = InternetTable.rows(RC);
    var ColCount = ObjectRow.cells.length;
    for (var CC = 0; CC &lt; ColCount; CC++)
    {
    CurrentSheet.Cells(RC + 1, CC + 1) = ObjectRow.Cells(CC).outerText;
    }
    }
    ExcelObject.DisplayAlerts = false;
    CurrentBook.SaveAs(FileName);
    ExcelObject.ActiveWorkBook.Close;
    ExcelObject.Quit();
    Log.Message("Table saved : " + FileName);
    }
    else
    Log.Message("Wrong object. Table is not saved.");
    }
    </pre><hr />
    Best regards,
    David - SmartBear Support

  4. #4
    Junior Member
    Join Date
    Jul 2007
    Posts
    13
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: vbscript for fetching data from html to xls

    HI,
    Thank You very much
    This code helped me alot


    regards,
    Krishna

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 06:20 PM.

Copyright BetaSoft Inc.