×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Import Favorites from IE

Import Favorites from IE

Import Favorites from IE

(OP)
I would like to import favorites from IE to a *.tps file.

I would normally use a *.csv file for this purpose but IE does not allow me to export my favorites to a *.csv file, only to a HTML file.

Is there any way I can import my favorites from IE to a *.tps file?

Thanks.
 

RE: Import Favorites from IE

Hi!

All Favorites are stored in the C:\Documents and Settings\<WindowsUserName>\Favorites folder on XP and C:\Users\<WindowsUserName>\Favorites on Win7. Just use DIRECTORY() and scan through the folder and all it's sub-folders and open the Internet Shortcut files as a ASCII file and get your information. An example shortcut file is shown below ::

CODE

[InternetShortcut]
URL=http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&plcid=&pver=6.1&os=&over=&olcid=&clcid=&ar=Media&sba=RadioBar&o1=&o2=&o3=
Modified=3078545FFF99C701BB

Regards
 

RE: Import Favorites from IE

(OP)
Thank you ShankarJ

The bit I do not understand is after using DIRECTORY() to locate the favorites folder how do I go about scanning the folder and its sub folders and return the shortcuts as a ACSII file?

 

RE: Import Favorites from IE

Hi!

CODE

DirQueue         QUEUE,PRE(DQ)
FullPath           STRING(512)
                 END

FileQueue        QUEUE(File:queue),PRE(FQ)
                 END

URLQueue         QUEUE,PRE(URL)
Name               STRING(256)
Link               STRING(1024)
                 END                 
                 
LOC:Path         STRING(512)
LOC:Counter      LONG
LOC:Inner        LONG
LOC:ASCFileName  STRING(512)

ASCFile          FILE,DRIVER('ASCII'),PRE(ASC),NAME(LOC:ASCFileName)
Record             RECORD
Data                 STRING(512)
                 . .

  FREE(URLQueue)
  
  DQ:FullPath = 'C:\Documents and Settings\<WindowsUserName>\Favorites\'
  ADD(DirQueue)

  LOC:Counter = 0
  LOOP
     LOC:Counter += 1
    
     GET(DirQueue, LOC:Counter)
     IF ERRORCODE() THEN BREAK.
    
     LOC:Path = DQ:FullPath
    
     FREE(FileQueue)
     DIRECTORY(FileQueue, CLIP(LOC:Path) & '*.*', ff_:Normal+ff_:DIRECTORY)
     LOC:Inner = 0
     LOOP
        LOC:Inner += 1
      
        GET(FileQueue, LOC:Inner)
        IF ERRORCODE() THEN BREAK.
  
        IF BAND(FQ:Attrib,ff_:DIRECTORY) AND FQ:ShortName <> '..' AND FQ:ShortName <> '.'
           DQ:FullPath = CLIP(LOC:Path) & CLIP(FQ:Name) & '\'
           ADD(DirQueue)
        ELSE
           LOC:ASCFileName = CLIP(LOC:Path) & CLIP(FQ:Name)
           CLOSE(ASCFile)
           OPEN(ASCFile,40H)
           IF ERRORCODE()
           ELSE
              SET(ASCFile)
              LOOP
                 NEXT(ASCFile)
                 
                 IF ERRORCODE() THEN BREAK.
                 
                 IF SUB(ASC:Data,1,4) = 'URL='
                    CLEAR(URLQueue)
                    URL:Name = FQ:FileName
                    URL:Link = SUB(ASC:Data,5,LEN(CLIP(ASC:Data))-4)
                    
                    ADD(URLQueue)
                    
                    BREAK
                 END
              END
              CLOSE(ASCFile)
           END
        END
     END
  END

Make sure you add the ASCII driver to your project's Database drivers. You can scan through the URLQueue and copy it to a TPS file.

Regards
 

RE: Import Favorites from IE

(OP)
Thanks for all your trouble ShankarJ, much appreciated, I will give it a go.

Just as a point of interest though I have found that a simple batch file like the one below seems to work OK (did not fully test) but would I be right in saying that its not a good practice to run a batch file(s) from an app?

cd \
cd MyFavoritesFolder
copy *.url url.txt

Kind Regards.

RE: Import Favorites from IE

Hi!

Are you sure that "copy *.url url.txt" will copy all the URLs into one file? You could use "for %f in (*.url) do type %f >> url.txt" instead.

Running a batch file is not an issue but IMHO a liability as the application depends on something outside it.

Regards
 

RE: Import Favorites from IE

(OP)
Hi ShankarJ

Yes, sorry my mistake, the batch file example I posted will not copy all the files. Having thought about it a bit more I would not use a batch file as I am not comfortable in doing so but I thought it was still worth a mention as an easy way for anyone wanting to export their own favorites to text.

Thanks again for all your help.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close