How to Access user's IE Favorites?

Questions and information about creating Internet aware NeoBook applications. Including PHP, HTML, FTP, HTTP, Email, etc.

Moderator: Neosoft Support

Locked
User avatar
fkapnist
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece
Contact:

How to Access user's IE Favorites?

Post by fkapnist »

I wonder if anyone has found a way for the Neobook browser-object to add and open an item to and from the user's IE Favorites folder? (Although Microsoft claims ease of use, it is mostly propriety -based, for its own Windows applications)... maybe a VB script?

:?:
.
User avatar
fkapnist
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece
Contact:

Re: How to Access user's IE Favorites?

Post by fkapnist »

fkapnist wrote:I wonder if anyone has found a way for the Neobook browser-object to add and open an item to and from the user's IE Favorites folder? (Although Microsoft claims ease of use, it is mostly propriety -based, for its own Windows applications)...

:?:
.
The Following by Jim Brammer works pretty good when adding to Favorites list (but change the Google var to your current URL)

SetVar "[Title]" "Google"
SetVar "[URL]" "http://google.com/"

FileWrite "C:\Users\[UserName]\Favorites\[Title].URL" "1" "[#91]DEFAULT[#93]"
FileWrite "C:\Users\[UserName]\Favorites\[Title].URL" "Append" "BASEURL=[URL]"
FileWrite "C:\Users\[UserName]\Favorites\[Title].URL" "Append" ""
FileWrite "C:\Users\[UserName]\Favorites\[Title].URL" "Append" "[#91]InternetShortcut[#93]"
FileWrite "C:\Users\[UserName]\Favorites\[Title].URL" "Append" "URL=[URL]"
FileWrite "C:\Users\[UserName]\Favorites\[Title].URL" "Append" ""


(Now I need another function to open the Favorites list and select an item)

:o

.
Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Re: How to Access user's IE Favorites?

Post by Neosoft Support »

You could use the FileList action:

FileList "C:\Users\[UserName]\Favorites\*.url" "Files+NoExt" "[Favorites]"

The NeoBookFM/FTP plug-in has more options for listing and selecting files.
NeoSoft Support
User avatar
fkapnist
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece
Contact:

Re: How to Access user's IE Favorites?

Post by fkapnist »

Neosoft Support wrote:You could use the FileList action:

FileList "C:\Users\[UserName]\Favorites\*.url" "Files+NoExt" "[Favorites]"

The NeoBookFM/FTP plug-in has more options for listing and selecting files.
This path in the Neosoft Support example: C:\Users\[UserName]\Favorites\*.url
makes a list of favorites titles, not their URLs. How do I get a list of the actual links?

Microsoft doesn't offer an API to access the explorer bookmarks structure. But some useful info is found here:
http://www.codeproject.com/Articles/222 ... onstructed


Here is an easy solution I just did.
The favorites titles are actually file names that end with ".url"
In this example the favorites are listed in ComboBox3.
Search for the string "URL=" and FileWrite it as tmp.txt file.
Then FileRead back only the 1st line of tmp.txt.
Replace URL= and all quotation marks with nothing.
Then send the new string to be opened in WebBrowser1.

Code: Select all

FileRead "C:\Users\[UserName]\Favorites\[ComboBox3].url" "All" "[vfav]"
.Delay "100"
SearchStr "URL=" "[vfav]" "[vfavUrl]" "CaseSensitive"
.Delay "100"
SubStr "[vfav]" "[vfavUrl]" "1500" "[vfavNumber]"
FileWrite "[TempDir]tmp.txt" "All" "[vfavNumber]"
FileRead "[TempDir]tmp.txt" "1" "[vfavURL]"
.Delay "100""
StrReplace "[#34][vfavURL][#34]" "URL=" "" "[vfavFav]" "CaseSensitive"
.Delay "100"
StrReplace "[vfavFav]" "[#34]" "" "[vfavUrlanswer]" ""
.Delay "100"
SetVar "[TextEntry1]" "[vfavUrlanswer]"
BrowserGoTo "WebBrowser1" "[TextEntry1]"

:arrow:

.
Last edited by fkapnist on Sat Aug 22, 2015 1:40 pm, edited 2 times in total.
Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Re: How to Access user's IE Favorites?

Post by Neosoft Support »

How do I get a list of the actual links?
You have to read the files and parse them. The url files are plain text so you can read them with FileRead or FileToVar and use SearchStr to locate the line containing the url.

Sample favorite file:

Code: Select all

[DEFAULT]
BASEURL=http://www.networksolutions.com/whois/index.jsp
[InternetShortcut]
URL=http://www.networksolutions.com/whois/index.jsp
IDList=
IconFile=http://www.networksolutions.com/favicon.ico
...
NeoSoft Support
Locked