VBScript to adjust all visual settings

Discussion in 'Scripting' started by badsyntax32, Jun 28, 2013.

  1. badsyntax32

    badsyntax32 MDL Novice

    Jun 25, 2013
    8
    7
    0
    #1 badsyntax32, Jun 28, 2013
    Last edited by a moderator: Apr 20, 2017
    Here u go. Very handy for fresh installations. Have more of this stuff for those interested.

    Code:
    ' =============== VISUAL EFFECTS ===============
    
    A = "0" ' Animate controls and elements inside windows
    B = "0" ' Fade or slide menu's into view
    C = "0" ' Fade or slide ToolTips into view
    D = "0" ' Fade out menu items after clicking
    E = "0" ' Show shadows under mouse pointer
    F = "0" ' Show shadows under windows
    G = "0" ' Slide open combo boxes
    H = "0" ' Smooth-scroll list boxes
    I = "1" ' Use visual styles on windows and buttons
    J = "1" ' Show window contents while dragging
    K = "1" ' Smooth edges of screen fonts
    L = "0" ' Animate windows when minimizing and maximizing
    M = "1" ' Show translucent selection rectangle
    N = "1" ' Use drop shadows for icon labels on the desktop
    O = "0" ' Animations in the taskbar and Start Menu
    P = "0" ' Show thumbnails instead of icons
    Q = "1" ' Enable desktop composition
    R = "0" ' Enable transparent glass
    S = "0" ' Enable Aero Peek
    T = "0" ' Save taskbar thumbnail previews
    
    ' ==============================================
    
    
    UPM_a = Array(_
    Array("1","0","0","1", H , G , B ,"0"),_
    Array("0","0", E ,"1", C , D ,"1","0"),_
    Array("0","0","0","0","0", F , I ,"1"),_
    Array("1","0","0","0","0","0","0","0"),_
    Array("0","0","0","1","0","0", A ,"0"),_
    Array("0","0","0","0","0","0","0","0"),_
    Array("0","0","0","0","0","0","0","0"),_
    Array("0","0","0","0","0","0","0","0")_
    )
    UPM_b = Array(Empty, Empty, Empty, Empty, Empty, Empty, Empty, Empty)
    Dim i
    For i = 0 To UBound(UPM_a)
      UPM_b(i) = CStr(BinToDec(UPM_a(i)))
    Next
    
    
    Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
    objReg.SetBinaryValue &H80000001, "Control Panel\Desktop", "UserPreferencesMask", UPM_b
    objReg.SetStringValue &H80000001, "Control Panel\Desktop", "DragFullWindows", IIf(J = "1", "1", "0")
    objReg.SetStringValue &H80000001, "Control Panel\Desktop", "FontSmoothing", IIf(K = "1", "2", "0")
    objReg.SetStringValue &H80000001, "Control Panel\Desktop\WindowMetrics", "MinAnimate", IIf(L = "1", "1", "0")
    objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ListviewAlphaSelect", IIf(M = "1", 1, 0)
    objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ListviewShadow", IIf(N = "1", 1, 0)
    objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAnimations", IIf(O = "1", 1, 0)
    objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "IconsOnly", IIf(P = "1", 0, 1)
    objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\DWM", "Composition", IIf(Q = "1", 1, 0)
    objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\DWM", "CompositionPolicy", IIf(Q = "1", 2, 0)
    objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\DWM", "ColorizationOpaqueBlend", IIf(R = "1", 0, 1)
    objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\DWM", "EnableAeroPeek", IIf(S = "1", 1, 0)
    objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\DWM", "AlwaysHibernateThumbnails", IIf(T = "1", 1, 0)
    objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects", "VisualFXSetting", 3
    
    
    Function BinToDec(arrBin())
      Dim r, i
      r = 0
      For i = UBound(arrBin) To 0 Step -1
        If arrBin(i) = "1" Then r = r + (2 ^ (UBound(arrBin) - i))
      Next
      BinToDec = r
    End Function
    
    
    Function IIf(Expression, TruePart, FalsePart)
      If Expression = True Then
        If IsObject(TruePart) Then Set IIf = TruePart Else IIf = TruePart
      Else
        If IsObject(FalsePart) Then Set IIf = FalsePart Else IIf = FalsePart
      End If
    End Function
    
    Relogging on is required ofcourse.
     
  2. Dos_Probie

    Dos_Probie MDL Senior Member

    Jul 18, 2012
    250
    86
    10
    Error when running on Win 8 x64

    When I run your code gives me a Windows Script Host syntax error on Line 78 Char 11..
     
  3. badsyntax32

    badsyntax32 MDL Novice

    Jun 25, 2013
    8
    7
    0
    You're doing something wrong. The script only has 77 lines.
     
  4. Dos_Probie

    Dos_Probie MDL Senior Member

    Jul 18, 2012
    250
    86
    10
    Thanks, got it working now :biggrin: