Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2006
    Posts
    16

    Extracting data from web object

    Hi I'm working on a browser project with ams 5. I want the application to search for a string within the body of an online webpage (within a web object) and use that value for subsequent actions, does anyone have an ideas about how I could do this?

    Process would be as follows:

    User browses to web page, ams5 reads value from (page source) body of displayed page and stores value either to a string? or to a text file? and then retrieves the value when needed.

    I can't define the webpage as a web address and download the webpage because the site uses a token to define the user/session and changes each time they log on.

    Does anyone have any ideas about how I could do this?

    Thanks in anticipation Rob

  2. #2
    Join Date
    May 2004
    Location
    Belgium
    Posts
    129
    I had a similar, problem and got source with clipboard plugin

    see this one: Get Source from Web, post28

    see entire tread for other solutions, thnx to Worm

  3. #3
    Join Date
    Apr 2006
    Posts
    16

    extracting source from webpage

    Thanks johnraus for your help I'm still struggling though... :(

    function GetSourceFromWeb(html) -- Retrieve Content from Embedded Web Object
    -- if html is TRUE returns loaded HTML data
    -- if html is FALSE returns loaded TEXT data

    datastring = "";
    local remember = "";
    local rcount = 0;

    if Clipboard.IsTextAvailable()
    then
    remember = Clipboard.GetText(); -- Only works with text on clipboard
    Clipboard.CopyText("");
    end;
    Application.Sleep(10);
    if html
    then Web.LoadURL("Web1", "javascript:void(window.clipboardData.setData(\"Te xt\", document.body.createTextRange().htmlText));");
    else Web.LoadURL("Web1", "javascript:void(window.clipboardData.setData(\"Te xt\", document.body.createTextRange().text));");
    end;
    repeat
    Application.Sleep(10);
    rcount = rcount +1;
    until Clipboard.IsTextAvailable() or rcount==50;
    if rcount < 50
    then
    datastring = Clipboard.GetText();
    Application.Sleep(10);
    Debug.Print("Get Source from Web O.K. "..rcount.."\r\n");
    else
    Debug.Print("Get Source from Web FAILED\r\n");
    end;
    Clipboard.CopyText(remember);

    return datastring;

    end;
    I think this code from worm would do it but I'd like to then write the html to a local file on the hardrive afterward (or have a means of searching for a value within the source)

    Any further ideas would be really appreciated.

    Many thanks Rob

  4. #4
    Join Date
    May 2004
    Location
    Belgium
    Posts
    129
    @robmaggs

    I think you've made a few typo's,
    clipboardData.setData(\"Te xt\" should be clipboardData.setData(\"Text\"

    Quote Originally Posted by johnraus View Post
    I had a similar, problem and got source with clipboard plugin
    see this one: Get Source from Web, post28
    for my solution, Enable Clipboard Plugin, put above code in Global Functions

    to get source to variable content

    sSource = GetSourceFromWeb(true);

    then

    Dialog.Message("Page Source", sSource);
    or
    result = String.Find(sSource, "abcde", 1, false);
    or
    TextFile.WriteFromString("FileName", sSource, false);



    for Worm's solutions look here

  5. #5
    Join Date
    Apr 2006
    Posts
    16

    Thanks Johnraus

    Thanks Johnraus,

    You are an absolute star, I was making a stupid mistake and not putting the code in the global settings. Thanks again for your help, I really appreciate it.

    All the best Rob

Similar Threads

  1. Web Object Right Click Management
    By Roboblue in forum AutoPlay Media Studio 7.5 Examples
    Replies: 9
    Last Post: 12-24-2007, 01:56 PM
  2. Problem getting HTML data from Web object
    By johnraus in forum AutoPlay Media Studio 5.0
    Replies: 28
    Last Post: 12-05-2006, 02:16 PM
  3. HOW TO: Return a Web Browser Object to the Original URL after a Page Jump
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 02-03-2003, 09:18 AM
  4. INFO: Difference between the Media Player Object and the AVI Object
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-29-2002, 02:15 PM
  5. Replies: 0
    Last Post: 10-04-2002, 10:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts