当鼠标位于屏幕右下角时滚动滚轮调节音量
;功能:当鼠标位于屏幕右下角时滚动滚轮调节音量
#MaxThreads 6
#InstallKeybdHook
color1 = 6BD536
color2 = FFFFFF
color3 = 94632D
color4 = FFCD00
color5 = AA55AA
color6 = FF5555
random,n,1,6
barcolor := color%n% ;取随机色的写法,我会看下色彩的理论,再写出随机生成颜色的代码,因为我还不知道计算明度跟饱和度的公式.
current := 80 ;初始音量值
gui,1:-caption +alwaysontop +owner ;去标题栏
gui,1:margin,0,0 ;去边距
gui,1:color,3F3F3F ;随便设置一个背景色,以备后面设置透明用
gui,1:font,s16 cwhite,Arial
gui,1:add,text,x7 y0,-
gui,1:add,text,x190 y1,+
gui,1:add,progress,x21 y2 w165 h22 c%barcolor% background3F3F3F vMyProgress, 80
gui,1:show,w208 h26,mainboard
;~Gui,1:+LastFound ;设置为LastFound
;~GUI_ID:=WinExist() ;获得窗口的句柄
winset,TransColor,black 200,mainboard
gui,1:Hide
send, {volume_up 50}
send, {volume_down 10} ;我的win7用volume_up&down,效果出来都是双倍的,up10就是加20,下同
SetTimer, Check, 50
Check:
SysGet, MonFull, Monitor ;获取显示信息 输出到MonFull变量
MouseGetPos, xpos, ypos , Win ;获取鼠标坐标(相对于当前窗口)
WinGetPos, X, Y, , , A ;获取窗口坐标
xscreen:=xpos+X ;相对屏幕坐标
yscreen:=ypos+Y
If (xscreen<MonFullRight*0.9 and yscreen<MonFullBottom*0.95)
gui,1:Hide
If (current > 100)
current := 100
If (current < 0)
current := 0
Return
;==================================================
~WheelUp::
;MsgBox, %xpos%,%ypos%,%X%,%Y%,%xscreen%,%yscreen%,%MonFullRight%,%MonFullBottom%
If (xscreen>MonFullRight*0.9 and yscreen>MonFullBottom*0.95)
{
gui,1:Show
Loop,5
{
current:=current+2
GuiControl,,MyProgress,%current%
Sleep 50
}
Send {Volume_Up 5}
}
Return
~WheelDown::
If (xscreen>MonFullRight*0.9 and yscreen>MonFullBottom*0.95)
{
gui,1:Show
Loop,5
{
current:=current-2
GuiControl,,MyProgress,%current%
Sleep 50
}
Send {Volume_Down 5}
}
return
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。


如果调节音量的默认快捷键不合手,可以自己改前面的按键,比如把 ^Up 改成 #Up(Win+上)~
谢谢评论!有什么问题欢迎继续交流 👏