obfuscatedv Posted February 11, 2014 Share Posted February 11, 2014 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 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 11, 2014 Moderators Share Posted February 11, 2014 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) "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
obfuscatedv Posted February 11, 2014 Author Share Posted February 11, 2014 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") Link to comment Share on other sites More sharing options...
Moderators Solution JLogan3o13 Posted February 11, 2014 Moderators Solution Share Posted February 11, 2014 This works just fine for me: #include <File.au3> $aArray = _FileListToArray(@FavoritesDir, "*", 1, 1) For $element In $aArray If StringInStr($element, "Google Home Page") Then FileDelete($element) Next "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
obfuscatedv Posted February 11, 2014 Author Share Posted February 11, 2014 Thanks, that works pretty well Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now