kpu Posted January 18, 2005 Share Posted January 18, 2005 (edited) Hey All,I've been using Auto It for little things here and there and I'm tring to do the following.I need to clear the History of IE after it closes. We have people who use our company PC's for personal use, which is allowed, and I need to be able to clear the cache (History, Temp, and Cookies) after the IE is closed. For some reason I can't get it to delete the History of the users profile. I found this topic at Microft as well.Microsoft TopicI've seen someones else's code that does this, it was more complex, but I can't find it. Can someone please give me some pointers. I wrote the code with MsgBox's so I know where it is in the code. Here is what I have so far. Also, if anyone knows where else I should delete files from, please fill me in. expandcollapse popupProcessWait("IEXPLORE.exe") MsgBox(0,"Internet", "Iexplore is present","") ProcessWaitClose("IEXPLORE.exe") MsgBox(0,"Internet", "Iexplore is not present","") ;--------DELETE HISTORY-----------------------> $hisdelete = FileDelete(@UserProfileDir & "\Local Settings\History\*.*") if $hisdelete = "0" Then MsgBox(0,"","History File's weren't deleted","") Else MsgBox(0,"","History File was deleted","") EndIf ;--------DELETE TEMP FILES----------------------> $Tempdelete = FileDelete(@UserProfileDir & "\Local Settings\Temp\*.*") if $Tempdelete = "0" Then MsgBox(0,"","Temp File's weren't deleted","") Else MsgBox(0,"","Temp File was deleted","") EndIf ;--------DELETE TEMP INTERNET FILES--------------> $TempIEdelete = FileDelete(@UserProfileDir & "\Local Settings\Temporary Internet Files\*.*") if $TempIEdelete = "0" Then MsgBox(0,"","Temp Internet File's weren't deleted","") Else MsgBox(0,"","Temp Internet File was deleted","") EndIf ;--------DELETE COOKIES--------------------------> $TempCdelete = FileDelete(@UserProfileDir & "\Cookies\*.txt") if $TempCdelete = "0" Then MsgBox(0,"","Cookies weren't deleted","") Else MsgBox(0,"","Cookies was deleted","") EndIf ;--------DELETE Typed URLs FROM REGISTRY--------------------------> $DelReg = RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs",) if $DelReg = "2" Then MsgBox(0,"","RegKey Delete Didn't work","") Else MsgBox(0,"","RegKey was deleted","") EndIf ExitOh, and before I forget. I need to run this with admin rights. Is there a way to do that without building another script using the "RunAsSet" command from another script calling this script? So, lets say the code above is compiled to an executable called . "IE2.exe" Below is how I've normally done it..RunAsSet("Administrator", @Computername, "adminpassword") RunWait("IE2.exe") RunAsSet()Thanks! Edited January 18, 2005 by kpu http://www.kpunderground.com Link to comment Share on other sites More sharing options...
kpu Posted January 18, 2005 Author Share Posted January 18, 2005 Interesting... No one has any comments... http://www.kpunderground.com Link to comment Share on other sites More sharing options...
BasicOs Posted January 18, 2005 Share Posted January 18, 2005 Interesting... No one has any comments... <{POST_SNAPBACK}>I enjoyed your script, but is not better to config every pc through registry to clear history of the Internet Explorer. Windows do it automatcly if you wish. Autoit.es - Foro Autoit en Español Word visitors Image Clustrmap image: - Football Spanish team - Spanish team: Casillas, Iniesta, Villa, Xavi, Puyol, Campdevilla, etc..Programando en Autoit+Html - Coding Autoit-Html - Arranca programas desde Internet - Preprocesador de Autoit a http Link to comment Share on other sites More sharing options...
kpu Posted January 18, 2005 Author Share Posted January 18, 2005 I'm sorry, I don't understand your reply. Windows do it automatcly if you wish.Are you saying you can configure windows to do it automaticaly? If so, how? Thanks! http://www.kpunderground.com Link to comment Share on other sites More sharing options...
kpu Posted January 18, 2005 Author Share Posted January 18, 2005 Does anyone know the command to lauch the the clear history using the Rundll32.exe Example: Here's how you can launch the IE Properties page in XP. "C:\WINDOWS\system32\rundll32.exe" /d shell32.dll,Control_RunDLL INETCPL.CPL I'm almost positive XP uses some kind of command to delete the files.. Just WHAT!!! http://www.kpunderground.com Link to comment Share on other sites More sharing options...
BasicOs Posted January 18, 2005 Share Posted January 18, 2005 (edited) No command, as far as I know.It uses a key in the registry, I can't remember exactly, may be in Policy, but you can find it easily.Does anyone know the command to lauch the the clear history using the Rundll32.exeExample: Here's how you can launch the IE Properties page in XP."C:\WINDOWS\system32\rundll32.exe" /d shell32.dll,Control_RunDLL INETCPL.CPLI'm almost positive XP uses some kind of command to delete the files.. Just WHAT!!! <{POST_SNAPBACK}> Edited January 18, 2005 by BasicOs Autoit.es - Foro Autoit en Español Word visitors Image Clustrmap image: - Football Spanish team - Spanish team: Casillas, Iniesta, Villa, Xavi, Puyol, Campdevilla, etc..Programando en Autoit+Html - Coding Autoit-Html - Arranca programas desde Internet - Preprocesador de Autoit a http Link to comment Share on other sites More sharing options...
MattX Posted January 18, 2005 Share Posted January 18, 2005 I did this quite a while back for PCs at my old place of work before I got made redundant - the site used a web based mail system and when PCs got infected with a worm that scanned HTML files for E-mail addresses it started to spread internally 'cos the pratts who setup the mail server turned off authentication. Anyway its OLD but you may find some handy pointers + remember it was for PCs running W2K. It may be better writing something which fires off MS delprof prog instead...Note this is using Ver2 of Autoit.; Program that Deletes Users History & Cache Files To Prevent Worm E-Mail address Scans; Version 1.0; Written By Matt ; Created March 22nd 2004; Last updated March 2004;Display Message BoxMsgBox, 4, Cache Delete Program. Written By Matt. March 2004, This will Delete your Internet Cache, Suspect & History files to prevent E-mail address scans from taking place on your device. Please note only the ID's files thats currently logged on will be removed. Continue ? IfMsgBox, No, Goto, quitSplashtexton, 300, 100, Cache Delete Program, Deleting your History, Suspect and Internet Cache Files. Please wait.IfExist, c:\\OFFICESCAN NT ,goto, check Ifnotexist, C:\\OFFICESCAN NT ,goto, cachecheck: Runwait, %COMSPEC% /C DEL C:\\"officescan nt"\\suspect\\*.* /f /s /q /a R S H Sleep, 5000cache: Runwait, %COMSPEC% /C DEL C:\\"documents and settings"\\%username%\\"local settings"\\*.* /f /s /q /a R S H Sleep, 3000 Splashtextoff;Final MessageMsgBox, 0, Cache Delete Program, Deletion of Files Sucessful. Exitquit:Exit Link to comment Share on other sites More sharing options...
kpu Posted January 18, 2005 Author Share Posted January 18, 2005 Well, I have a found a solution to this. I still have one issue though. I can't get the "Clean manager" window to move. I had it working, and then it would work. If anyone knows why, please let me know. MattX, Thanks for your code as well. I haven't tried it, but I'm sure it will work too. Here it is. Changes in Internet Explorer--------------------------------------------------------------------------------1. In Internet Properties, click on the "General" Tab, Click "Clear History", the change the amount of days to keep in history to "0".2. In Internet Properties, click on the "Content" Tab, then click on "AutoComplete.." Uncheck the boxes for "Web Address", "User names and passwords on forms", and "Prompt me to save passwords".3. In Internet Properties, click on the "Advanced" Tab, under the "Security" section. Check and the box for "Empty Temporary Internet Files folders when browser is closed". (I had to uncheck, click "Apply". Then check and click "Apply" for this to work.) 4. Remove the "History" button in IE. (I think I did this, but I will have to check) Registry Changes--------------------------------------------------------------------------------1. Change the permissions on "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs" to "Deny" for the user. My Little Program--------------------------------------------------------------------------------1. At the command prompt run the following command. "cleanmgr /sageset:1". This will bring up the Clean Manager. Select what Items you want to delete. I chose everything except for "Compressed Files". 2. Copy "IE MOD.exe" and "IEXPLORE2.EXE" to "C:\Program files\Internet Explorer" 3. Change the Internet Explorer link so it points to "IEXPLORER.EXE" to "IEXPLORE2.EXE" What my Program Does --------------------------------------------------------------------------------"IE MOD.exe" launches "IEXPLORER.EXE" with admin rights. This is so it will be able to run the Clean Manager. The command "cleanmgr /sageset:1" sets what files it will cleanup or delete. "IEXPLORER2.EXE" waits for "IEXPLORE.EXE" process to end. It then will then launch "cleanmgr /sagerun:1" which will then delete the selected files with the first command.CODE FOR "IE MOD.exe" AutoItSetOption ( "TrayIconHide", 1) RunAsSet("Administrator", @Computername, "adminpassword") RunWait("IEXPLORE2.exe") RunAsSet()CODE FOR IEXPLORE2.EXE run("iexplore.exe") ProcessWait("IEXPLORE.exe") ProcessWaitClose("IEXPLORE.exe") Sleep(1000) ;--------DELETE Typed URLs FROM REGISTRY--------------------------> RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs",) ;-------RUNS CLEANUP MANAGER WITH "/SAGERUN:1" ON THE END OF IT. run("cleanmgr /sagerun:1","c:\windows\system32\",) WinWaitActive("Disk Cleanup","") sleep(1500) WinMove( "Disk Cleanup", "" , @desktopHeight, 0 , "" ) http://www.kpunderground.com 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