Link to home
Start Free TrialLog in
Avatar of rincewind666
rincewind666

asked on

Getting description/keywords from current open Internet Explorer.

I am writing a favorites/bookmark program. I need to get the description and/or keywords from the current open page of Internet Explorer (as supplied with Windows XP).

I am using Delphi 6. I need the delphi code for this (as a beginner). I am giving 500 points as it is important.

Any help would be appreciated. Thanks.
Avatar of rincewind666
rincewind666

ASKER

By the way, I already know the URL, if that's any help...
This should be possible as you could temporarily downlaod the HTML open it and view it. I will post an example soon
To download here is a good example:

https://www.experts-exchange.com/questions/20977025/Download-file-from-internet.html

Once downloaded do a search by loading into a richedit control (richedit1.lines.loadfromfile(...))

Then find the required text: an example:

https://www.experts-exchange.com/questions/10223606/RichEdit-and-Search.html

Regards,

Hypoviax

I have loaded the following sample html page into richedit1.  What is the delphi 6 code to extract the description into descriptionlabel and the keywords into keywordlabel?  Many thanks for your help.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0023)http://www.lycos.co.uk/ -->
<HTML><HEAD><TITLE>Lycos - meet you there : Picture Search / Chat / Free SMS Messages</TITLE>
<META http-equiv=content-type content="text/html; charset=iso-8859-1">
<META
content="Lycos Search for pictures, chat, free sms messages and all your portal requirements"
name=description>
<META content="Lycos, picture search, chat, free sms messages"
name=keywords><LINK media=all
href="Lycos - meet you there  Pict.....etc.
Using richedit fintext:

FoundAt := RichEdit1.FindText('"', 0, length(richedit1.length), [stMatchCase]);//find start of description
Endof:=RichEdit1.FindText('"', foundat, length(richedit1.length), [stMatchCase]); //find end


then you can use the copy function to return the text

resultdesc:=copy(richedit1.text,foundat,foundat-endof);

You do the same thing for the keywords:


FoundAtKey := RichEdit1.FindText('"', endof, length(richedit1.length), [stMatchCase]);//find start of keywords
Endofkey:=RichEdit1.FindText('"', foundatkey, length(richedit1.length), [stMatchCase]); //find end


then you can use the copy function to return the text

resultkeywords:=copy(richedit1.text,foundatkey,foundatkey-endofkey);

You may need to fiddle around with it because i did it off the top of my head

Regards,

Hypoviax
Sorry Hypoviax, it didn't work - I think because the character appears many times in the code.  Nothing works so far.  Never mind, I am trying another way:

I have copied the entire html page "head" section into a string:  

S := <HEAD><TITLE>Lycos - meet you there : Picture Search / Chat / Free SMS Messages</TITLE><META http-equiv=content-type content="text/html; harset=iso-8859-1"><META content="Lycos Search for pictures, chat, free sms messages and all your portal requirements" name=description><META content="Lycos, picture search, chat, free sms messages" name=keywords><LINK media=all href="Lycos - meet you there  Pict.....etc.

Now I need to get rid of surplus text (<HEAD>, <TITLE>, <META>, etc) - a list of words which will probably always appear in this string. I realize that some words will be missed but as long as I get the words that nearly always appear. To cut down the size of this string, I need to delete these words.  I will have these words in a listbox or stringlist.

I need the delphi 6 code to delete a list of words from a string.  I hope you can help. Many thanks if you can.
I've been a bit busy, but i can help. if you have time i will be able to post perhaps a complete working version in a couple of days. However have a look here:

https://www.experts-exchange.com/questions/20861127/Deleting-word-in-string.html

for deleting words from a string
ASKER CERTIFIED SOLUTION
Avatar of Eddie Shipman
Eddie Shipman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Apologies for the delay, due to personal reasons. Anyway, thanks for the help, everyone.