PageRenderTime 44ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/AutoHotkey.docset/Contents/Resources/Documents/scripts/VolumeOSD.htm

https://gitlab.com/ahkscript/Autohotkey.docset
HTML | 143 lines | 117 code | 26 blank | 0 comment | 0 complexity | 44da42cd394a1539c504cba77fa24145 MD5 | raw file
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Volume On-Screen-Display (OSD) -- by Rajat</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <link href="../static/theme.css" rel="stylesheet" type="text/css" />
  8. <script src="../static/content.js" type="text/javascript"></script>
  9. </head>
  10. <body>
  11. <h1>Volume On-Screen-Display (OSD) -- by Rajat</h1>
  12. <p>This script assigns hotkeys of your choice to raise and lower the
  13. master and/or wave volume. Both volumes are displayed as different
  14. color bar graphs.
  15. </p>
  16. <p><a href="VolumeOSD.ahk">Download This Script</a> &nbsp;| &nbsp;<a href="index.htm">Other Sample Scripts</a> &nbsp;| &nbsp;<a href="../AutoHotkey.htm">Home</a></p>
  17. <pre class="NoIndent"><em>;_________________________________________________
  18. ;_______User Settings_____________________________</em>
  19. <em>; Make customisation only in this area or hotkey area only!!</em>
  20. <em>; The percentage by which to raise or lower the volume each time:</em>
  21. vol_Step = 4
  22. <em>; How long to display the volume level bar graphs:</em>
  23. vol_DisplayTime = 2000
  24. <em>; Master Volume Bar color (see the help file to use more
  25. ; precise shades):</em>
  26. vol_CBM = Red
  27. <em>; Wave Volume Bar color</em>
  28. vol_CBW = Blue
  29. <em>; Background color</em>
  30. vol_CW = Silver
  31. <em>; Bar's screen position. Use -1 to center the bar in that dimension:</em>
  32. vol_PosX = -1
  33. vol_PosY = -1
  34. vol_Width = 150 <em>; width of bar</em>
  35. vol_Thick = 12 <em>; thickness of bar</em>
  36. <em>; If your keyboard has multimedia buttons for Volume, you can
  37. ; try changing the below hotkeys to use them by specifying
  38. ; Volume_Up, ^Volume_Up, Volume_Down, and ^Volume_Down:</em>
  39. HotKey, #Up, vol_MasterUp <em>; Win+UpArrow</em>
  40. HotKey, #Down, vol_MasterDown
  41. HotKey, +#Up, vol_WaveUp <em>; Shift+Win+UpArrow</em>
  42. HotKey, +#Down, vol_WaveDown
  43. <em>;___________________________________________
  44. ;_____Auto Execute Section__________________</em>
  45. <em>; DON'T CHANGE ANYTHING HERE (unless you know what you're doing).</em>
  46. vol_BarOptionsMaster = 1:B ZH%vol_Thick% ZX0 ZY0 W%vol_Width% CB%vol_CBM% CW%vol_CW%
  47. vol_BarOptionsWave = 2:B ZH%vol_Thick% ZX0 ZY0 W%vol_Width% CB%vol_CBW% CW%vol_CW%
  48. <em>; If the X position has been specified, add it to the options.
  49. ; Otherwise, omit it to center the bar horizontally:</em>
  50. if vol_PosX &gt;= 0
  51. {
  52. vol_BarOptionsMaster = %vol_BarOptionsMaster% X%vol_PosX%
  53. vol_BarOptionsWave = %vol_BarOptionsWave% X%vol_PosX%
  54. }
  55. <em>; If the Y position has been specified, add it to the options.
  56. ; Otherwise, omit it to have it calculated later:</em>
  57. if vol_PosY &gt;= 0
  58. {
  59. vol_BarOptionsMaster = %vol_BarOptionsMaster% Y%vol_PosY%
  60. vol_PosY_wave = %vol_PosY%
  61. vol_PosY_wave += %vol_Thick%
  62. vol_BarOptionsWave = %vol_BarOptionsWave% Y%vol_PosY_wave%
  63. }
  64. #SingleInstance
  65. SetBatchLines, 10ms
  66. Return
  67. <em>;___________________________________________</em>
  68. vol_WaveUp:
  69. SoundSet, +%vol_Step%, Wave
  70. Gosub, vol_ShowBars
  71. return
  72. vol_WaveDown:
  73. SoundSet, -%vol_Step%, Wave
  74. Gosub, vol_ShowBars
  75. return
  76. vol_MasterUp:
  77. SoundSet, +%vol_Step%
  78. Gosub, vol_ShowBars
  79. return
  80. vol_MasterDown:
  81. SoundSet, -%vol_Step%
  82. Gosub, vol_ShowBars
  83. return
  84. vol_ShowBars:
  85. <em>; To prevent the &quot;flashing&quot; effect, only create the bar window if it
  86. ; doesn't already exist:</em>
  87. IfWinNotExist, vol_Wave
  88. Progress, %vol_BarOptionsWave%, , , vol_Wave
  89. IfWinNotExist, vol_Master
  90. {
  91. <em>; Calculate position here in case screen resolution changes while</em>
  92. <em>; the script is running:</em>
  93. if vol_PosY &lt; 0
  94. {
  95. <em>; Create the Wave bar just above the Master bar:</em>
  96. WinGetPos, , vol_Wave_Posy, , , vol_Wave
  97. vol_Wave_Posy -= %vol_Thick%
  98. Progress, %vol_BarOptionsMaster% Y%vol_Wave_Posy%, , , vol_Master
  99. }
  100. else
  101. Progress, %vol_BarOptionsMaster%, , , vol_Master
  102. }
  103. <em>; Get both volumes in case the user or an external program changed them:</em>
  104. SoundGet, vol_Master, Master
  105. SoundGet, vol_Wave, Wave
  106. Progress, 1:%vol_Master%
  107. Progress, 2:%vol_Wave%
  108. SetTimer, vol_BarOff, %vol_DisplayTime%
  109. return
  110. vol_BarOff:
  111. SetTimer, vol_BarOff, off
  112. Progress, 1:Off
  113. Progress, 2:Off
  114. return
  115. </pre>
  116. </body>
  117. </html>