Jump to content

delete cookies


mendrofa
 Share

Recommended Posts

6 hours ago, aleph01 said:

In the search window or in the run command type shell:cookies.  That'll open a window to where your cookies are stored.  Use that path and the filedelete command.

Path may vary from OS version. Use the API designed for this:

#include "WinINet.au3"

$avCacheEntry = _WinINet_FindFirstUrlCacheEntry(1)
If Not @error Then
    $hCacheEntry = $avCacheEntry[0]
    $avCacheEntryInfo = $avCacheEntry[1]

    While Not @error
        _WinINet_DeleteUrlCacheEntry($avCacheEntryInfo[1])
        
        $avCacheEntryInfo = _WinINet_FindNextUrlCacheEntry($hCacheEntry)
    WEnd
    _WinINet_FindCloseUrlCache($hCacheEntry)
EndIf

The WinINet.au3 can be found here: WinINet.au3 (FTP/HTTP/HTTPS/Gopher+)

FYI the script is using a macro, now removed in the WinINetConstants.au3. On line 5 simply replace @AutoItUnicode with 1 like so:

Global Const $AU3_UNICODE = Number($AU3_VERSION[2] & "." & $AU3_VERSION[3]) >= 2.13 Or 1

Note that the _WinINet_DeleteUrlCacheEntry sets @error if the function succeeds instead of expected behavior

Edited by genius257
Link to comment
Share on other sites

  • 1 month later...

@genius257   I tried your code, but no full success.

Running IE11 on WIN10
Some cookies were deleted, but not all. All newer cookies were not found e.g. Google.com , Bing.com
A search for ".cookie" on the Home drive C: showed about 150 existing cookies.  I deleted them all.
Furthermore, I deleted cookies in IE11

Then I called 'Google.com' on IE11. After that, there were 4 cookies from Google.
Always searching for '.cookie' on the home drive is no good solution, isn't it?

My goal is to delete those Google cookies. How can I do this with AutoIt?

TIA Exit


 

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

Here a code to display all cookies and to delete selected cookies.

#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>

$searchfor = "Google."

Local $aArray = _FileListToArrayRec(@UserProfileDir, "*.cookie", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH)
_ArrayDisplay($aArray, "All cookie data sets")
For $i = 1 To $aArray[0]
    $sFiledata = FileRead($aArray[$i])
    ConsoleWrite($aArray[$i] & @CRLF & $sFiledata & @CRLF & @CRLF)
    If StringInStr($sFiledata, $searchfor) Then
        If MsgBox($MB_YESNO + $MB_ICONQUESTION + $MB_DEFBUTTON2, $searchfor, $aArray[$i] & @CRLF & @CRLF & $sFiledata & @CRLF & @CRLF & "Delete this cookie ?", 0) = $IDYES Then FileRecycle($aArray[$i])
    EndIf
Next

 

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...