mendrofa Posted September 25, 2016 Share Posted September 25, 2016 how to make script delete cookies in IE Link to comment Share on other sites More sharing options...
aleph01 Posted September 26, 2016 Share Posted September 26, 2016 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. Meds. They're not just for breakfast anymore. Link to comment Share on other sites More sharing options...
Exit Posted September 26, 2016 Share Posted September 26, 2016 unfortunately, "shell:cookies" shows not all cookies. Just type ":cookies" in search field of home drive and you'll see much more cookies. App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
genius257 Posted September 26, 2016 Share Posted September 26, 2016 (edited) 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 September 26, 2016 by genius257 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
Exit Posted October 29, 2016 Share Posted October 29, 2016 @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 More sharing options...
Exit Posted October 29, 2016 Share Posted October 29, 2016 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 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