Module: Muter
Constant Summary collapse
- VK_VOLUME_DOWN =
from msdn on keybd_event …
0xAE
- VK_VOLUME_UP =
0xAF
- VK_VOLUME_MUTE =
0xAD
- KEYEVENTF_KEYUP =
2
- @@use_mouse_click =
true
Instance Method Summary collapse
- #hit_mute_key ⇒ Object
- #hit_volume_down_key ⇒ Object
- #hit_volume_up_key ⇒ Object
- #mute! ⇒ Object
-
#unmute! ⇒ Object
LODO better for doze 7/xp.
Instance Method Details
#hit_mute_key ⇒ Object
38 39 40 41 42 |
# File 'lib/muter.rb', line 38 def hit_mute_key # simulate pressing the mute key keybd_event(VK_VOLUME_MUTE, 0, 0, nil) keybd_event(VK_VOLUME_MUTE, 0, KEYEVENTF_KEYUP, nil) end |
#hit_volume_down_key ⇒ Object
50 51 52 53 54 |
# File 'lib/muter.rb', line 50 def hit_volume_down_key p 'hitting down volume key' keybd_event(VK_VOLUME_DOWN, 0, 0, nil) keybd_event(VK_VOLUME_DOWN, 0, KEYEVENTF_KEYUP, nil) end |
#hit_volume_up_key ⇒ Object
44 45 46 47 48 |
# File 'lib/muter.rb', line 44 def hit_volume_up_key p 'hitting up volume key' keybd_event(VK_VOLUME_UP, 0, 0, nil) keybd_event(VK_VOLUME_UP, 0, KEYEVENTF_KEYUP, nil) end |
#mute! ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/muter.rb', line 56 def mute! #unmute! # just in case...somehow this was causing problems...windows 7 perhaps? VLC? # anyway we just use a toggle for now...dangerous but works hopefully... if @@use_mouse_click Mouse. else hit_mute_key end end |
#unmute! ⇒ Object
LODO better for doze 7/xp
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/muter.rb', line 69 def unmute! if @@use_mouse_click Mouse. elsif @@use_static_on_top elsif @@use_down_volume_button @@use_down_volume_button_number.times { hit_volume_up_key } else hit_mute_key # Windows XP... hit_volume_down_key hit_volume_up_key end end |