Jump to content
Sign in to follow this  
KaFu

W7T - Win7 Tweaker

Recommended Posts

KaFu

With Win7 I think there are some few features I'm missing compared to Win XP, some extra features which are utilizing the DWM (I the long run I plan to integrate my SAT - Simple AERO Thumbnailer example into this one), some registry tweaks which need to be applied (did you notice the annoying empty CD drive AutoOpen "feature"?), some tricks to be documented. Just a start...

Pre-Requisite

Compile in line to you @OSArch (x86 or 64bit).

Auto-Update directory content in Explorer

A feature I'm really missing in WIN7s (Vistas too?) Explorer... auto-update of the folder contents on folder change via keyboard arrows up and down, you'll always have to do an additional click or hit enter, in WinXP this happened automatically...

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=W7T_Icon.ico
#AutoIt3Wrapper_outfile=W7T.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.6.1
    Author:         KaFu

    Script Function:
    W7T - Win7 Tweaker
    Version: 0.0.0.5
    13-May-2010

    - x86 and 64bit Versions necessary....

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

#include <Timers.au3>
#include <Misc.au3>

Global $hwnd_Active_Save
Global $dll_user32 = DllOpen("user32.dll")
_EnforceSingleInstance('f9e3d422-36fe-4889-aa1a-ee53b4ec1be3') ; any 'unique' string; created with http://www.guidgen.com/Index.aspx

Opt("TrayOnEventMode", 1)
Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 1)

; _W7T_Add_to_AutoStart() ; un-comment to add w7t to autostart

HotKeySet("^!{ESC}", "_Exit")

ToolTip("Program is running. Press CTRL+ALT+ESC to exit.", @DesktopWidth - 300, @DesktopHeight - 40, "Win7 Explorer - Autoupdate", 1, 4)
Sleep(2000)
ToolTip("")
TraySetToolTip("Win7 Tweaker")
$c_tray_exit = TrayCreateItem("Win7 Tweaker - Exit")
TrayItemSetOnEvent(-1, "_Exit")

AdlibRegister("_Explorer_AutoUpdate_Right_Pane", 200)

While 1
    Sleep(100)
WEnd

Func _Explorer_AutoUpdate_Right_Pane()
    Local $iTimer_prevent_stuckinloop, $iTimer_MouseLeftClick

    $hwnd_Active = WinGetHandle("[ACTIVE]", "")

    If $hwnd_Active <> $hwnd_Active_Save Then

        $hwnd_Active_Save = $hwnd_Active
        $hwnd_Explorer = _Explorer_Win_Active()

        If IsHWnd($hwnd_Explorer) Then

            $hwnd_Explorer_Ctrl = ControlGetHandle($hwnd_Explorer, "", "[CLASSNN:SysTreeView321]")
            If IsHWnd($hwnd_Explorer_Ctrl) Then
                $s_Explorer_Ctrl_TextBuffer = ControlTreeView($hwnd_Explorer, "", $hwnd_Explorer_Ctrl, "GetSelected")
                $s_Explorer_Ctrl_TextBuffer_Save = $s_Explorer_Ctrl_TextBuffer

                While 1

                    Sleep(25)
                    $s_Explorer_Ctrl_TextBuffer = ControlTreeView($hwnd_Explorer, "", $hwnd_Explorer_Ctrl, "GetSelected")

                    If _IsPressed("01", $dll_user32) Then $iTimer_MouseLeftClick = TimerInit()

                    If $s_Explorer_Ctrl_TextBuffer <> $s_Explorer_Ctrl_TextBuffer_Save Then
                        If TimerDiff($iTimer_MouseLeftClick) < 200 Then
                            $s_Explorer_Ctrl_TextBuffer_Save = $s_Explorer_Ctrl_TextBuffer
                        Else
                            $iTimer_prevent_stuckinloop = TimerInit()
                            While 1
                                Sleep(25)
                                If _Timer_GetIdleTime() > 200 Or TimerDiff($iTimer_prevent_stuckinloop) > 10000 Then ExitLoop
                            WEnd
                            $s_Explorer_Ctrl_TextBuffer = ControlTreeView($hwnd_Explorer, "", $hwnd_Explorer_Ctrl, "GetSelected")
                            If $s_Explorer_Ctrl_TextBuffer <> $s_Explorer_Ctrl_TextBuffer_Save Then
                                If _Timer_GetIdleTime() > 200 Then ControlSend($hwnd_Explorer, "", $hwnd_Explorer_Ctrl, "{ENTER}")
                                $s_Explorer_Ctrl_TextBuffer_Save = $s_Explorer_Ctrl_TextBuffer
                            EndIf
                        EndIf
                    EndIf

                    If WinGetHandle("[ACTIVE]", "") <> $hwnd_Active_Save Then ExitLoop

                WEnd
            EndIf

        EndIf
    EndIf

EndFunc   ;==>_Explorer_AutoUpdate_Right_Pane

Func _Explorer_Win_Active()
    Local $hwnd = WinGetHandle("[ACTIVE]", "")
    Local $iPID = WinGetProcess($hwnd, "")
    Local $iPID_List = ProcessList("explorer.exe")
    For $i = 1 To $iPID_List[0][0]
        If $iPID_List[$i][1] = $iPID Then
            ;ConsoleWrite(WinGetTitle($hwnd) & @CRLF)
            Return $hwnd
        EndIf
    Next
    ;ConsoleWrite(WinGetTitle($hwnd) & @CRLF)
    Return False
EndFunc   ;==>_Explorer_Win_Active

Func _Exit()
    DllClose($dll_user32)
    AdlibUnRegister("_Explorer_AutoUpdate_Right_Pane")
    Exit
EndFunc   ;==>_Exit

Func _W7T_Add_to_AutoStart()
    If @Compiled Then
        FileDelete(@StartupDir & "\Win7 Tweaker.lnk")
        FileCreateShortcut(@ScriptDir & "\" & @ScriptName, @StartupDir & "\Win7 Tweaker.lnk", @ScriptDir, "minimized", "Win7 Tweaker Autostart Link", @ScriptDir & "\" & @ScriptName, "", "0", @SW_MINIMIZE)
    EndIf
EndFunc   ;==>_W7T_Add_to_AutoStart

Func _EnforceSingleInstance($GUID_Program)
    If $GUID_Program = "" Then Return SetError(1, '', 1)
    If IsHWnd(WinGetHandle($GUID_Program)) Then
        Exit
    EndIf
    AutoItWinSetTitle($GUID_Program)
    Return WinGetHandle($GUID_Program)
EndFunc   ;==>_EnforceSingleInstance

W7T_Icon.ico

Edited by KaFu

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  

×