;致谢各路英雄豪杰。 ;作者:时间刺客 /*/ TimeS SingleInstance, force ;~ #NoTrayIcon ;是否启用托盘 NoEnv SetBatchLines -1 Menu, Tray, NoStandard
;Mhotkey /*****/
;根据鼠标所在位置,设置快捷命令。
;致谢各路英雄豪杰。
;作者:时间刺客 /*****/ TimeS
#SingleInstance, force
;~ #NoTrayIcon ;是否启用托盘
#NoEnv
SetBatchLines -1
Menu, Tray, NoStandard
Menu, tray, add ,禁用,<禁用脚本>
Menu, tray, add ,重启,<Menu_Tray_Reload>
Menu, tray, add ,说明,<Menu_Tray_Explain>
Menu, tray, Add
Menu, tray, Add, 退出, <ExitSub>
Menu, Tray, Default, 禁用
CoordMode, Mouse, Screen ;指定鼠标坐标以屏幕为基准
a:=10 ;a=最多离开边缘多少像素
x:= "" ;鼠标位置获取变量x
y:= "" ;鼠标位置获取变量y
SetTimer, MouseHOVER,250
MOUSEHOVER(){ ;鼠标位置函数调用
global x,y,winId, ControlClass
MouseGetPos, OutputVarX, OutputVarY
x:=OutputVarX
y:= OutputVarY
}
;{_______[滚轮声音设置所需]_______
Volume_Delay:=1000
BG_color=1A1A1A
Text_color=FFFFFF
Bar_color=666666
Volume_OSD_CEnter:=1
over_tray:=1 ;}
;{_______[任务栏隐藏所需命令行]_______
ABM_SETSTATE := 10
ABS_NORMAL := 0x0
ABS_AUTOHIDE := 0x1
ABS_AlwaysOnTOP := 0x2
VarSetCapacity( APPBARDATA , 36, 0 )
Off := NumPut( 36, APPBARDATA )
Off := NumPut( WinExist("ahk_class Shell_TrayWnd"), Off+0 )
;}
MouseGetPos, x, y
;_______[左边缘]_______
;~ #If x<a && y>=a && y<A_ScreenHeight-(a+1) ;{
;~ MButton:: ;{
;~ return ;}
;~ WheelUp::
;~ return
;~ WheelDown::
;~ return
;~ #If ;}
;_______[左上角]_______
#If x<a&&y<a ;{
$WheelUp:: ;{增大音量
Send {Volume_Up}
gosub, <Volume_Show_OSD>
return ;}
$WheelDown:: ;{减小音量
Send {Volume_Down}
gosub, <Volume_Show_OSD>
return ;}
$MButton:: ;{切换静音
Send {Volume_Mute}
return ;}
if (Volume_OSD_CEnter)
{
mY := (A_ScreenHeight/2)-26, mX := (A_ScreenWidth/2)-165
}
else
{
SysGet m, MonitorWorkArea, 1
mY := mBottom-52-2, mX := mRight-330-2
}
SoundGet, Volume
if (!Volume_OSD_c)
{
Volume_ProgressbarOpts=CW%BG_color% CT%Text_color% CB%Bar_color% x%mX% y%mY% w330 h52 B1 FS8 WM700 WS700 FM8 ZH12 ZY3 C11
Progress Hide %Volume_ProgressbarOpts%,,Volume,, Tahoma
Volume_OSD_c:=!Volume_OSD_c
}
Progress Show
Progress % Volume := Round(Volume), %Volume% `%
SetTimer, Remove_Show_OSD, %Volume_Delay%
return ;}
Remove_Show_OSD: ;{
SetTimer, Remove_Show_OSD, Off
Progress Hide %Volume_ProgressbarOpts%,,Volume,,Tahoma
return ;}
#If ;}
;_______[上边缘]_______
#If x>=a && x<A_ScreenWidth-(a+1) && y<a ;{
$MButton:: ;{切换最近任务
Send,!{Tab}
return ;}
$WheelUp:: ;切换桌面
$WheelDown:: ;{切换桌面
Send,#d
return ;}
#If ;}
;_______[右上角]_______
#If x>=A_ScreenWidth-(a+1) && y<a ;{
$MButton:: ;{隐藏或者显示任务栏
IfWinExist,ahk_class Shell_TrayWnd ;判断是否存在任务栏窗口
{
NumPut( ABS_AUTOHIDE|ABS_AlwaysOnTOP, Off+24 )
DllCall("Shell32.dll\SHAppBarMessage", UInt,ABM_SETSTATE, UInt,&APPBARDATA )
WinHide ahk_class Shell_TrayWnd
WinHide ahk_class Button
return
}else{
NumPut( ABS_AlwaysOnTOP, Off+24 )
DllCall("Shell32.dll\SHAppBarMessage", UInt,ABM_SETSTATE, UInt,&APPBARDATA )
WinShow ahk_class Shell_TrayWnd
WinShow ahk_class Button
return
}
return ;}
;~ $WheelUp:: ;{切换通知区域
;~ $WheelDown::
;~ IfWinExist,ahk_class NotifyIconOverflowWindow ;判断是否存在任务栏窗口
;~ {
;~ WinHide ahk_class NotifyIconOverflowWindow
;~ return
;~ }else{
;~ WinShow ahk_class NotifyIconOverflowWindow
;~ return
;~ }
;~ return ;}
#If ;}
;_______[右边缘]_______
;~ #If x>=A_ScreenWidth-(a+1) && y>=a && y<A_ScreenHeight-(a+1) ;{
;~ MButton::
;~ MsgBox, 右Box, 右Box, 右
;~ MButton::AltTabMenu
;~ WheelDown::AltTab
;~ WheelUp::ShiftAltTab
;~ return
;~ WheelUp::
;~ return
;~ WheelDown::
;~ return
;~ #If ;}
;_______[右下角]_______
;~ #If x>=A_ScreenWidth-(a+1) && y>=A_ScreenHeight-(a+1) ;{
;~ MButton::
;~ MsgBox, 右下角
;~ return
;~ #If ;}
;_______[下边缘]_______
#If x>=a && x<A_ScreenWidth-(a+1) && y>=A_ScreenHeight-(a+1) ;{
$MButton:: ;{搜索
ClipSaved := ClipboardAll
clipContent := ""
Clipboard =
Send,^c
Sleep 100
if ErrorLevel
{
Clipboard := ClipSaved
ClipSaved =
return
}
clipContent = %clipboard%
Clipboard := ClipSaved
ClipSaved =
if ! clipContent ;复制内容是否为空
return
else
Run,www.baidu.com/s?wd=%clipContent%
return ;}
;}
#If ;} ;}
;_______[左下角]_______
#If x<a && y>=A_ScreenHeight-(a+1) ;{
$MButton:: ;{打开任务管理器
Run,taskmgr.exe
return ;}
;~ WheelUp::
;~ return
;~ WheelDown::
;~ return
#If ;}
return
;{ 托盘图标设置
help=
(
根据鼠标所在位置,可根据需求设置热键.
左上角 上边缘 右上角
控制声音 显隐桌面 显隐任务栏
左边缘 右边缘
未定义 未定义
左下角 下边缘 右下角
任务管理器 百度搜索 未定义
)
MsgBox,% help
return
Reload
return
ExitApp
return
if 禁用
Reload
禁用=1
Gui 1:Destroy
Menu, Tray, Icon,ban.ico,, 1
Menu, Tray, Default, 禁用
Suspend
return
;}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。


你也写了这么一个?我也写了一个。把屏幕分成9格,如果是全屏,可以分成25格。(最外面的边单独也化成格子。)这是根据鼠标位置,执行不同的动作。