Just Do IT !

Windows 10上用AutoHotkey实现快速隐藏/显示桌面图标与切换虚拟桌面

字数统计: 316阅读时长: 1 min
2020/01/16 Share

在这里插入图片描述
当你想用多个桌面的时候需要按ctrl+Windows+左右键 觉得很麻烦怎么办?

下载 AutoHotkey

编辑脚本 添加以下内容

1
2
3
4
5
6
~LControl & WheelUp::
Send {LWin Down}{Ctrl Down}{Left}{Ctrl Up}{LWin Up}
return
~LControl & WheelDown::
Send {LWin Down}{Ctrl Down}{Right}{Ctrl Up}{LWin Up}
return

这样左Ctrl+鼠标滚轮即可实现切换桌面

快速隐藏桌面图标

添加

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
!q::
HideOrShowDesktopIcons()
return

HideOrShowDesktopIcons()
{
ControlGet, class, Hwnd,, SysListView321, ahk_class Progman
If class =
ControlGet, class, Hwnd,, SysListView321, ahk_class WorkerW

If DllCall("IsWindowVisible", UInt,class)
WinHide, ahk_id %class%
Else
WinShow, ahk_id %class%
}

alt+q 实现快速隐藏图标

如何创建脚本

在这里插入图片描述

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

~LControl & WheelUp::
Send {LWin Down}{Ctrl Down}{Left}{Ctrl Up}{LWin Up}
return
~LControl & WheelDown::
Send {LWin Down}{Ctrl Down}{Right}{Ctrl Up}{LWin Up}
return

!q::
HideOrShowDesktopIcons()
return

HideOrShowDesktopIcons()
{
ControlGet, class, Hwnd,, SysListView321, ahk_class Progman
If class =
ControlGet, class, Hwnd,, SysListView321, ahk_class WorkerW

If DllCall("IsWindowVisible", UInt,class)
WinHide, ahk_id %class%
Else
WinShow, ahk_id %class%
}

添加以上内容 功能可全部实现

将脚本添加到启动中可以开机自启.

CATALOG
  1. 1. 下载 AutoHotkey
  2. 2. 快速隐藏桌面图标
  3. 3. 如何创建脚本