Page 1 of 1

a bookmarks file reader

Posted: Fri Jul 30, 2010 3:17 am
by dan2130
Hi , i want to create a system to import all the internet explorer bookmarks automaticly in one of my next service but i dont know hot to really get the good string for the URL and the string with the name
here is an example of bookmarks file content :

[DEFAULT]
BASEURL=http://www.codenstuff.com/forum/home.php
[InternetShortcut]
URL=http://www.codenstuff.com/forum/home.php
Modified=E0B4FE5C952FCB017E
IconFile=http://www.codenstuff.com/favicon.ico
IconIndex=1

the strings i want to extract is the string with the URL and the iconFile string and the title of the file.
thanks in advance for your help
have a nice day !

Re: a bookmarks file reader

Posted: Fri Jul 30, 2010 8:01 pm
by mandai
Since a URL shortcut is just a text file you can use this to search through the lines:
Code: Select all
        Dim lines As String() = File.ReadAllLines("link.url")

        Dim url As String = ""
        Dim ico As String = ""
        For i As Integer = 0 To lines.Length - 1
            If lines(i).StartsWith("BASEURL=") Then
                url = lines(i).Remove(0, 8)
            ElseIf lines(i).StartsWith("IconFile=") Then
                ico = lines(i).Remove(0, 9)
            End If
        Next

        MsgBox("URL is: " & url)
        MsgBox("Icon is: " & ico)

Re: a bookmarks file reader

Posted: Fri Jul 30, 2010 8:03 pm
by dan2130
thanks i will try that now

Re: a bookmarks file reader

Posted: Sat Jul 31, 2010 11:37 am
by Lewis
Mandai, have i ever told you? Your brilliant!

Re: a bookmarks file reader

Posted: Sat Jul 31, 2010 4:09 pm
by dan2130
yeah he are verry brillant that work !