Results 1 to 3 of 3

Thread: Reading text from a webpage

  1. #1
    Join Date
    Jul 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Reading text from a webpage

    Hi!

    I'm new with SCAR. I'm trying to read some text from a webpage frame. I've selected the frame with the window selector and I was trying to select the text using the GetTextAtEx() function, but I can't get it working.

    Can anyone give me an example on how to read text from web browser page?

    Thanks a lot!

  2. #2
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    A web page? Quite simple: GetPage();

    Here's an example.

    SCAR Code:
    program New;

    var
      Text: String;

    begin
      Text := GetPage('http://www.google.com');
      Writeln(Text);
    end.

    And parsing would be something like this:

    SCAR Code:
    program New;

    var
      Text: String;
      SubString: String;
      Position: Integer;

    begin
      Text := GetPage('http://www.google.com');
      Writeln(Text);
      SubString := 'charset=ISO-8859-1"><title';
      Position := Pos(SubString, Text);
      Writeln(IntToStr(Position);
      Delete(Text, 1, Position + Length(SubString));
      Writeln(Text);
      SubString := 'Google<';
      Position := Pos(SubString, Text);
      Writeln(IntToStr(Position));
      Delete(Text, Length(SubString), Length(Text));
      Writeln(Text);
    end.

    It's a bit sloppy, but you get the idea

    I hope that was what you were looking for!

  3. #3
    Join Date
    Jul 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well, that isn't the best option to me because I'll have to do it repeatedly. My objective is to use the GetTextAtEx() or something, but I can't get it to work.

    Anyway, I would like to try the GetPage() but it's difficult too, because it's a frame that I want and I need to login to that page too, so it would be a lot easier to use the GetTextAtEx() or a similar function.

    Thanks a lot!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Grabbing or reading Text from a game text box
    By British in forum OSR Help
    Replies: 16
    Last Post: 02-27-2009, 08:02 AM
  2. Reading text
    By aran armath in forum OSR Help
    Replies: 2
    Last Post: 12-31-2007, 07:12 PM
  3. Colored text readin on webpage
    By Psychor in forum OSR Help
    Replies: 8
    Last Post: 12-21-2007, 07:51 PM
  4. Reading Text
    By Ransom in forum OSR Help
    Replies: 5
    Last Post: 11-17-2006, 04:38 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
  •