Jump to content

Set Auto Arrange icons on the desktop


Recommended Posts


' Registry constants
Const HDI_CLASSIC = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu"
Const HDI_NEW = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"
Const MY_COMPUTER = "\{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
Const MY_NETWORK_PLACES = "\{208D2C60-3AEA-1069-A2D7-08002B30309D}"
Const MY_DOCUMENTS = "\{450D8FBA-AD25-11D0-98A8-0800361B1103}"
Const INTERNET_EXPLORER = "\{871C5380-42A0-1069-A2EA-08002B30309D}"

' Edit registry to show all icons
With CreateObject("WScript.Shell")
.RegWrite HDI_CLASSIC & MY_COMPUTER, 0
.RegWrite HDI_CLASSIC & MY_NETWORK_PLACES, 0
.RegWrite HDI_CLASSIC & MY_DOCUMENTS, 0
.RegWrite HDI_CLASSIC & INTERNET_EXPLORER, 0
.RegWrite HDI_NEW & MY_COMPUTER, 0
.RegWrite HDI_NEW & MY_NETWORK_PLACES, 0
.RegWrite HDI_NEW & MY_DOCUMENTS, 0
.RegWrite HDI_NEW & INTERNET_EXPLORER, 0
End With

' Create explorer command file to toggle desktop window
Set oFSO = CreateObject("Scripting.FileSystemObject")
sSCFFile= oFSO.BuildPath(oFSO.GetSpecialFolder(2), oFSO.GetTempName &".scf")
With oFSO.CreateTextFile(sSCFFile, True)
.WriteLine("[Shell]")
.WriteLine("Command=2")
.WriteLine("[Taskbar]")
.WriteLine("Command=ToggleDesktop")
.Close
End With

' Toggle desktop and send F5 (refresh)
With CreateObject("WScript.Shell")
.Run """" & sSCFFile & """"
WScript.Sleep 100
.Sendkeys "{F5}+{F10}in"
WScript.Sleep 100
.Run """" & sSCFFile & """"
End With

' Delete explorer command file
oFSO.DeleteFile sSCFFile

Link to comment
Share on other sites

This is a script some else used to sort the desktop icons.

Dim Act, AppData, Fso, SD

Set Act = CreateObject("WScript.Shell")

Set Fso = CreateObject("Scripting.FileSystemObject")

SD = Act.ExpandEnvironmentStrings("%Systemdrive%")

AppData = Act.ExpandEnvironmentStrings("%Appdata%")

AppData = AppData & "\Microsoft\Internet Explorer\Quick Launch\Show Desktop.scf"

Act.Run(Chr(34) & AppData & Chr(34))

WScript.Sleep 1000

Act.sendkeys "{F5}"

WScript.Sleep 500

Act.sendkeys "+{F10}"

Act.sendkeys "I"

Act.sendkeys "A"

If Fso.FileExists(SD & "\SortIcons.vbs") Then Fso.DeleteFile(SD & "\SortIcons.vbs") End If

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
  • Recently Browsing   0 members

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