通过ahk实现类似mouseinc的边缘滚动调节音量的功能,有两个思路。
#If MouseIsOver("ahk_class Shell_TrayWnd")
WheelUp::Send {Volume_Up}
WheelDown::Send {Volume_Down}
return
#If
MouseIsOver(WinTitle) {
MouseGetPos,,, Win
return WinExist(WinTitle . " ahk_id " . Win)
}
其中x、y是窗口的相对位置
#Persistent
SetTimer, tag, 50
return
tag:
MouseGetPos, x, y, id, control
ToolTip, %x% %y%
if (y > A_ScreenHeight-15 && x > 300 && x < A_ScreenWidth-400){
send {Down}
}
else if(y < 15 && x > 300 && x < A_ScreenWidth-400){
send {Up}
}
return
如果是边缘滚动触发,bug比较多,此处是通过alt和wheelup键结合调节音量,但导致这个alt键用不了
#Persistent
SetTimer, tag, 50
return
tag:
MouseGetPos, x, y, id, control
;ToolTip, %x% %y%
if (y > A_ScreenHeight-15 && x > 300 && x < A_ScreenWidth-400){
send {Down}
send {alt up}
}
else if(y < 15 && x > 300 && x < A_ScreenWidth-400){
send {Up}
send {alt up}
}
else if( x > A_ScreenWidth-400 && y > 300 && y < A_ScreenHeight-400){
send {alt down}
}
else{
send {alt up}
}
return