Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Importing & Exporting bookmarks from IE, Opera, Netscape

Posted on 2003-11-07
5
Medium Priority
?
520 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
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 100 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Screencast - Getting to Know the Pipeline

927 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