我使用此脚本自动调整 Windows 文件资源管理器中每一列的宽度,当我打开“这台电脑”时,它完全分开:驱动器名称似乎被截断,我必须输入“ctrl +”(小键盘中的 + ) 自动调整。是否可以调整脚本?
; Sending "ctrl+" (+ in the numpad) to File Explorer to auto-adjust columns width, even for nested folders
; https://stackoverflow.com/questions/65048189/autohotkey-send-hotkeys-to-nested-folders
; SendInput ^+6 ; ctrl+shift+6 details list
; SendInput, ^{NumpadAdd}; ctrl+ (+ numpad)
;No need to create a gui, A_ScriptHwnd is used for this
DllCall("RegisterShellHookWindow", UInt, A_ScriptHwnd)
MsgNum := DllCall("RegisterWindowMessage", Str, "SHELLHOOK")
OnMessage(MsgNum, "ShellMessage")
Return
ShellMessage(wParam, lParam)
{
static _time := 0
if (wParam = 6 or wParam = 1 or wParam = 3 or wParam = 4 or wParam = 13 or wParam = 14) && (A_TickCount - _time > 150 && WinActive("A") = lParam)
{
_time := A_TickCount
WinGet, pname, ProcessName, % "ahk_id " lParam
if (pname = "explorer.exe")
{
ControlFocus, DirectUIHWND2, % "ahk_id " lParam
SendInput, ^{NumpadAdd}
SendInput ^+6
SendInput, ^{NumpadAdd} ;again just to be sure
}
}
}