利用autohotkey一键隐藏桌面图标 | 我的日常分享

利用autohotkey一键隐藏桌面图标

autohotkey一键隐藏桌面图标

autohotkey官网

一、Alt+q 一键隐藏桌面图标

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+w 一键关闭海螺桌面同时隐藏桌面图标

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
!w::
exitProcessHalo()
Sleep, 5
HideOrShowDesktopIcons()
return

exitProcessHalo(){
Process, Exist, HaloTray.exe
NewPID = %ErrorLevel%
if NewPID = 0
{
;弹出消息框MsgBox, Process doesnt exist
;MsgBox, Process doesnt exist
Run, C:\Program Files (x86)\HaloDesktop\HaloTray.exe
}
else
{
;弹出消息框MsgBox, Process exists
;MsgBox, Process exists
Loop
{
Process, Close, HaloTray.exe
Process, wait, HaloTray.exe, 0.1
NewPID = %ErrorLevel%
if NewPID = 0
{
break
}
}
Process, WaitClose, HaloTray.exe
}
;Loop
;{
; Process, Close, HaloTray.exe
; Process, wait, HaloTray.exe, 0.1
; NewPID = %ErrorLevel%
; if NewPID = 0
; {
; break
; }
;}
;Process, WaitClose, HaloTray.exe
;弹出消息框this works
;MsgBox, this works
}
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%
}