Advertisement
RyzaJr

[AHK] Volume.OSD

Mar 28th, 2015
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;This AHK script displays a volume window pop up when the mouse wheel is scrolled up or down on the taskbar.
  2.  
  3. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  4. ; #Warn  ; Enable warnings to assist with detecting common errors.
  5. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  6. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  7. #NoTrayIcon
  8. /*
  9.    This version, joedf, April 8th, 2013
  10.     - Update  May  23rd, 2013 [r1] - Added Tooltip to display volume %
  11.     - Update June   4th, 2013 [r2] - Added Volume OSD
  12.     - Update June   6th, 2013 [r3] - Added Hotkeys & over_tray options, Suggested by DataLife
  13. */
  14.     ;_______[Settings]_______
  15.         Volume_Delay:=1000
  16.         BG_color=1A1A1A
  17.         Text_color=FFFFFF
  18.         Bar_color=666666
  19.         Volume_OSD_Center:=1
  20.         over_tray:=1
  21.     ;________________________
  22.     ;________[HOTKEYS]_______
  23.                vol_up = WheelUp
  24.              vol_down = WheelDown
  25.           vol_up_fast = +%vol_up%   ;shift + (vol_up) hotkey
  26.         vol_down_fast = +%vol_down% ;shift + (vol_down) hotkey
  27.     ;________________________
  28. ;//////////////[Do not edit after this line]///////////////
  29. #If % (over_tray) ? MouseIsOver("ahk_class Shell_TrayWnd") : "(1)"
  30.     Hotkey, If, % (over_tray) ? MouseIsOver("ahk_class Shell_TrayWnd") : "(1)"
  31.     Hotkey,%vol_up%,vol_up
  32.     Hotkey,%vol_down%,vol_down
  33.     Hotkey,%vol_up_fast%,vol_up_fast
  34.     Hotkey,%vol_down_fast%,vol_down_fast
  35. return
  36. vol_up:
  37.    Send {Volume_Up}
  38.     gosub, Volume_Show_OSD
  39. return
  40. vol_up_fast:
  41.    Send {Volume_Up 4}
  42.     gosub, Volume_Show_OSD
  43. return
  44. vol_down:
  45.    Send {Volume_Down}
  46.     gosub, Volume_Show_OSD
  47. return
  48. vol_down_fast:
  49.    Send {Volume_Down 4}
  50.     gosub, Volume_Show_OSD
  51. return
  52. Volume_Show_OSD:
  53.    if (Volume_OSD_Center)
  54.     {
  55.         mY := (A_ScreenHeight/2)-26, mX := (A_ScreenWidth/2)-165
  56.     }
  57.     else
  58.     {
  59.         SysGet m, MonitorWorkArea, 1
  60.         mY := mBottom-52-2, mX := mRight-330-2
  61.     }
  62.     SoundGet, Volume
  63.     if (!Volume_OSD_c)
  64.     {
  65.         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
  66.         Progress Hide %Volume_ProgressbarOpts%,,Volume,, Tahoma
  67.         Volume_OSD_c:=!Volume_OSD_c
  68.     }
  69.     Progress Show
  70.     Progress % Volume := Round(Volume), %Volume% `%
  71.     SetTimer, Remove_Show_OSD, %Volume_Delay%
  72. return
  73. Remove_Show_OSD:
  74.    SetTimer, Remove_Show_OSD, Off
  75.     Progress Hide %Volume_ProgressbarOpts%,,Volume,,Tahoma
  76. return
  77. MouseIsOver(WinTitle) {
  78.     MouseGetPos,,, Win
  79.     return WinExist(WinTitle . " ahk_id " . Win)
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement