Jump to content
Sign in to follow this  
obfuscatedv

Best way to remove old favorites/bookmarks and add new one

Recommended Posts

obfuscatedv

If I were to remove favorites for a wildcard user xxx at C:usersxxxFavorites  and delete an internet shortcut?  Within this favorites folder, you can delete directories, but these are specifically internet shortcuts saved as "Google home page" for example.  So I cant use DirRemove.  

Same goes for adding a bookmark/favorite as an Internet Shortcut in the above path, instead of a folder. 

Any help is appreciated :)

Share this post


Link to post
Share on other sites
obfuscatedv

 

I would start with doing a _FileListToArray, then you can loop through and delete them if they match certain criteria:

#include <Array.au3>
#include <File.au3>
 
$aArray = _FileListToArray(@FavoritesDir, "*", 0, 1)
 _ArrayDisplay($aArray)

Thats pretty similar to what I had at first, however I couldnt get the script to delete "Google Home page"  Internet Shortcut.  I looked for the string "Google Home page" and using FileDelete if it found that string, but for some reason couldnt get it to work with the existing script posted below. 

#RequireAdmin
#NoTrayIcon

#include <array.au3>
#include <file.au3>

Local $ShortcutList = _FileListToArray(@FavoritesDir)
If @error = 1 Then
    MsgBox(0, "", "No folders Found.")
    Exit
EndIf
If @error = 4 Then
    MsgBox(0, "", "No files found.")
    Exit
EndIf
_ArrayDisplay($ShortcutList, "$ShortcutList")

Share this post


Link to post
Share on other sites
obfuscatedv

Thanks, that works pretty well

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×