Create multiple Windows URL shortcuts from bookmarks HTML file

I have a very large number of bookmarks in Google Chrome. I want to transfer all of them to the Windows folder, so that each bookmark will become a shortcut for the website (I want a list of shortcuts, like any list of regular application shortcuts). I would also like to keep the name and bookmark icon.

I was looking for a way to achieve my goal, but all I could find was either manually Create application shortcutsin Chrome or manually drag the links from the HTML file exported from bookmarks in the Chrome bookmark manager to a folder.

Since there is no easy solution (AFAIK), I thought about achieving it differently.

Basically, I have an HTML file named bookmarks.html(created by a function Export bookmarks to HTML filein Organizein Bookmark Manager). This is a long list of links ( <a>s) - I have over 250 bookmarks.

I can extract the data I need from the file, possibly using XML Parser, although this is possible even with a regular expression, because the structure is known and the same in the whole file:

...
<DT><A HREF="http://data.stackexchange.com/" ADD_DATE="1342120101" ICON="data:image/png;base64,iVBORw0......">Stack Exchange</A>
<DT><A HREF="http://www.istockphoto.com/" ADD_DATE="1285715116" ICON="data:image/png;base64,iVBORw0.......">Web Design</A>
<DT><A HREF="http://icons.mysitemyway.com/" ADD_DATE="1287435657" ICON="data:image/png;base64,iVBORw0........">Ico.etc</A>
<DT><A HREF="http://www.shutterstock.com/" ADD_DATE="1285715294" ICON="data:image/png;base64,iVBORw0.....">Shutterstock</A>
...

The problem is that I don’t know how to create a script that will receive data - for example, a URL, an icon (in base64) and a name - and create shortcuts to Windows URLs using this data. I know several VB scripts that can create custom shortcuts, but not several (well, about 300) shortcuts at once.

+5
source share
2 answers

, , , , . , , script, , .

Const ForReading = 1, ForWriting = 2, ForAppending = 8, CreateIfNeeded = true
outpath = "g:\script\shortcut\url2\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
bookmarkfile = "bookmarks.html"
Set bookmarks = objFSO.OpenTextFile(bookmarkfile, ForReading)
Set regEx = New RegExp
regEx.Global = True
Set regEx2 = New RegExp
regEx2.Global = True
regEx2.Pattern = "[^a-zA-Z0-9-_.]"

regEx.Pattern = "<DT><A HREF=""(.*)"" ADD_DATE.*>(.*)</A>"
do until bookmarks.AtEndOfStream
  line = bookmarks.readline()
  if regEx.test(line) then
    shortcut = regEx.Replace(line,"$1")
    filename = trim(regEx.Replace(line,"$2"))
    filename = Regex2.Replace(filename, "_")
    filename = outpath & left(filename, 80) & ".url"
    wscript.echo filename
    'the following skips invalid filenames, you should add a routine to filter out invalid filename characters in your codeset
    on error resume next
    Set objFile = objFSO.OpenTextFile(filename, ForWriting, CreateIfNeeded)
    if err.number <> 0 then
      wscript.echo err.description
    end if
    objFile.write "[InternetShortcut]" & vbcrlf & "URL=" & shortcut
    objFile.close
  end if
loop
+4

- geat -

CHROME BOOKMARKS ( GOOGLE BOOKMARKS) .html . Chrome ORGANIZE | . USER\. IE, IE , IE. CHROME BOOKMARKS. IE FAVORITES . . . , , .html, Chrome (# 1), CHROME BOOKMARKS, (# 2).

.url , Chrome, BOOKMARKS BAR OTHER BOOKMARKS.

, .URL Chrome .

- -

-1

All Articles