Solved

Importing & Exporting bookmarks from IE, Opera, Netscape

Posted on 2003-11-07
5
502 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
  • 3
  • 2
5 Comments
 
LVL 3

Expert Comment

by:fibdev
Comment Utility
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
Comment Utility
tnx for the code fibdev.
and for opera & netscape do you know how?
0
 
LVL 3

Accepted Solution

by:
fibdev earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Does anyone know how to import/export bookmarks from opera & Netscape or if there are any free components for doing this?
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now