Solved

Importing & Exporting bookmarks from IE, Opera, Netscape

Posted on 2003-11-07
5
513 Views
Last Modified: 2010-04-05
I need the code for importing & exporting the bookmarks from/To Internet Explorer, Opera and NetScape.
The imported bookmarks should be read in a record like this:


TDatabase=record
          Category:String;                
          Files: array[1..200] of TFiles;

TFiles=record
               Title:string;
               URL:String;
               Description:String;
          end;

Also the categories i want to be included into treview (inserted into curent node).


ex:
 if the bookmarks from internet are:
             Business // -category
                  url1   desctription <--- if any
                  url2   desctription <--- if any
                  ....
            
            Fun // -category
                  url1   desctription <--- if any
                  url2   desctription <--- if any
                  ....
            
to be read like this:
      category[i]:=business;
      category[i].Files[1].Title:=Title of the url
      category[i].Files[1].Url:= url1
      category[i].Files[1].Description:= DEscription  of url1
      
      Category[i].Files[2].Title:=Title of the url
      category[i].Files[2].Url:= url1
      category[i].Files[2].Description:= DEscription  of url1

      ........
      
      category[i]:=Fun;
      category[i].Files[1].Title:=Title of the url
      category[i].Files[1].Url:= url1
      category[i].Files[1].Description:= DEscription  of url1

      Category[i].Files[2].Title:=Title of the url
      category[i].Files[2].Url:= url1
      category[i].Files[2].Description:= DEscription  of url1
      .........
0
Comment
Question by:so3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 3

Expert Comment

by:fibdev
ID: 9705702
IE Favorites are stored in a directory...

Use this key to find the favorites directory of the current user...

add "Registry" to your uses list.

I was working on this, but I'm too tired to contiue.  maybe someone else can get it working...

unit Unit1;

interface

uses
  Windows, Messages, Registry, FileCtrl
,SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    Button1: TButton;
    function GetFavorites(): TStrings;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
function TForm1.GetFavorites(): TStrings;
var Favorites : TStrings ;
    FavDir : String;
    Reg : TRegistry;
    Rec : TSearchRec;
begin
    Reg := TRegistry.Create;
    reg.RootKey := HKEY_CURRENT_USER;
    if not reg.KeyExists('\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders')
       then ShowMessage('Could not locate IE Favorites')
    else
    Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', False);
    FavDir := Reg.ReadString('Favorites');
    try
    if FavDir[Length(FavDir)] <> '\' then FavDir:= FavDir + '\';
    if FindFirst(FavDir+'*.*', faAnyFile, Rec) = 0 then
       repeat
        if (rec.attr and faDirectory > 0)and(rec.name <> '.')and(rec.name <> '..') then
         //GetFavorites(FavDir+rec.name+'\')
       else
       Favorites.Add(rec.Name);
  until FindNext(Rec) <> 0;
  FindClose(Rec);
  result := Favorites;
  finally
   reg.Free;
  end;
  end;
procedure TForm1.Button1Click(Sender: TObject);
begin
        listbox1.Items.AddStrings(GetFavorites);
end;

end.
0
 
LVL 6

Author Comment

by:so3
ID: 9708285
tnx for the code fibdev.
and for opera & netscape do you know how?
0
 
LVL 3

Accepted Solution

by:
fibdev earned 50 total points
ID: 9708453
It was late when I started that and I never did get that function working.  I think it's a step in the right direction, but it needs work.

here is a link for a vcl that will do exactly what you are after.  they want $15 for it though...

http://www.delphipages.com/edit/count.cfm?ID=1430
0
 
LVL 6

Author Comment

by:so3
ID: 9711124
with the code above i succeded to get the favorites in my list but now i don't know how to proceed with the bookmarks from Opera & NetScape
0
 
LVL 6

Author Comment

by:so3
ID: 9760257
Does anyone know how to import/export bookmarks from opera & Netscape or if there are any free components for doing this?
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month3 days, 23 hours left to enroll

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question