当鼠标位于屏幕右下角时滚动滚轮调节音量
;功能:当鼠标位于屏幕右下角时滚动滚轮调节音量 #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