Sign in to follow this  
Followers 0
MattHiggs

Automatically generate URL shortcuts on desktop, clear IE cache, and reset to default settings

1 post in this topic

#1 ·  Posted (edited)

Hey all.  First script that I have posted that I thought might be useful to some.  It was a daily occurrence for me: someone has issues accessing a website or some internet related issue, and they need to have their IE cache cleared and Internet settings reset to default.  Tired of all of the repetitive emails, I wrote a script that I uploaded to my one drive for business, created a share link, and send to everyone who I receive a request from.  Now, I barely get any.  Life is good when you have computers do the hard work for you....  Oh, and I included at the beginning some commands which will create URL desktop shortcuts for the end users to quickly access important websites, as they usually access these sites not through IE directly, but an embedded IE object in another application, which can cause issues.  Knock yourself out.  **Edit Oh, and I forgot to mention, this will reset the IE settings to default, then launch an instance of IE, and waits to see if that annoying "Do you want to use default settings?" window pops up.  If it does, automatically gets rid of it and closes IE, and its done.  If it doesn't pop up, then it closes IE and its done.

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=ieinstal.ico
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
; *** Start added by AutoIt3Wrapper ***
#include <MsgBoxConstants.au3>
; *** End added by AutoIt3Wrapper ***
; *** Start added by AutoIt3Wrapper ***
#include <AutoItConstants.au3>
; *** End added by AutoIt3Wrapper ***
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.15.0 (Beta)
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
;#include '_SelfDelete.au3'
#include <Constants.au3>
#include <IE.au3>
If ProcessExists ( "iexplore.exe" ) Then
    Do
        ProcessClose ( "iexplore.exe" )
    Until Not ProcessExists ( "iexplore.exe" )
EndIf

RunWait ( @ComSpec & ' /c echo [InternetShortcut] > "%userprofile%\Desktop\Autoit.URL"', @SystemDir )
RunWait ( @ComSpec & ' /c echo URL=https://www.autoitscript.com/site/ >> "%userprofile%\Desktop\Autoit.URL"', @SystemDir )

RunWait ( @ComSpec & ' /c echo [InternetShortcut] > "%userprofile%\Desktop\Google.URL"', @SystemDir )
RunWait ( @ComSpec & ' /c echo URL=https://www.google.com/ >> "%userprofile%\Desktop\Google.URL"', @SystemDir )

RunWait ( @ComSpec & ' /c echo [InternetShortcut] > "%userprofile%\Desktop\MajorGeeks.URL"', @SystemDir )
RunWait ( @ComSpec & ' /c echo URL=http://www.majorgeeks.com/ >> "%userprofile%\Desktop\MajorGeeks.URL"', @SystemDir )

RunWait ( @ComSpec & ' /c echo [InternetShortcut] > "%userprofile%\Desktop\GitHub.URL"', @SystemDir )
RunWait ( @ComSpec & ' /c echo URL=https://github.com/ >> "%userprofile%\Desktop\GitHub.URL"', @SystemDir )

RunWait ( @ComSpec & " /c ipconfig /release", @SystemDir, @SW_SHOW )
RunWait ( @ComSpec & " /c ipconfig /renew", @SystemDir, @SW_SHOW )
RunWait ( @ComSpec & " /c ipconfig /flushdns", @SystemDir, @SW_SHOW )
RunWait ( @ComSpec & " /c ipconfig /registerdns", @SystemDir, @SW_SHOW )
Run (@ComSpec & " /c " & 'RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255', "", @SW_SHOW )
Run (@ComSpec & " /c " & 'RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32', "", @SW_SHOW )
Run (@ComSpec & " /c " & 'RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16', "", @SW_SHOW )
Run (@ComSpec & " /c " & 'RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1', "", @SW_SHOW )
RunWait (@ComSpec & " /c " & 'RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2', "", @SW_SHOW )
RunWait (@ComSpec & " /c " & 'RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8', "", @SW_SHOW )
RunWait (@ComSpec & " /c " & 'RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351', "", @SW_SHOW )
Sleep (2500)

Run ( "RunDll32.exe InetCpl.cpl,ResetIEtoDefaults" )
$ie = WinWait ( "Reset Internet Explorer Settings", "Are you sure you want to reset all Internet Explorer settings?" )
WinActivate ( $ie )
WinWaitActive ( $ie )
ControlClick ( $ie, "", "[CLASS:Button; INSTANCE:1]" )
ControlClick ( $ie, "", "[CLASS:Button; INSTANCE:2]" )
$ie2 = WinWait ( "Reset Internet Explorer Settings", "&Close" )
Sleep ( 1500 )
WinActivate ( $ie2 )
WinWaitActive ( $ie2 )
ControlClick ( $ie2, "", "[CLASS:Button; INSTANCE:1]" )
$oIE2 = _IECreate ( "https://www.autoitscript.com/site/" )
$annoy = WinWait ( "Internet Explorer 11", "Internet Explorer 11", 5 )
If $annoy = 0 Then
    _IEQuit ( $oIE2 )
    Do
        ProcessClose ( "iexplore.exe" )
    Until Not ProcessExists ( "iexplore.exe" )
#Region --- CodeWizard generated code Start ---

;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Info
MsgBox($MB_OK + $MB_ICONASTERISK,"Done","You are good to go")
#EndRegion --- CodeWizard generated code End ---
Else

WinActivate ( $annoy )
WinWaitActive ( $annoy )
ControlClick ( $annoy, "", "[CLASS:Button; INSTANCE:3]" )
Sleep ( 500 )
ControlClick ( $annoy, "", "[CLASS:Button; INSTANCE:1]" )
Sleep ( 3000 )
_IEQuit ( $oIE2 )
Sleep ( 1000 )
Do
    ProcessClose ( "iexplore.exe" )
Until Not ProcessExists ( "iexplore.exe" )
#Region --- CodeWizard generated code Start ---

;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Info
MsgBox($MB_OK + $MB_ICONASTERISK,"Done","You are good to go")
#EndRegion --- CodeWizard generated code End ---
EndIf

 

Edited by MattHiggs

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  
Followers 0