| View previous topic :: View next topic |
| Author |
Message |
slekvak Guest
|
Posted: Sun May 11, 2008 4:39 pm Post subject: Make space pause Media Player |
|
|
Hi,
I'm trying to make a script which make pressing space pause Windows Media Player. I have made this:
Space::
IfWinActive, Windows Media Player
{
send {Media_Play_Pause}
}
else {
send {Space}
}
return
But I can't get it to work. It works when media player is active (it pauses it), but the "else"-part doesnt work. I get this error: 71 hotkeys have been received in the last 711ms.
Why doesn't it work?
Thanks |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 753 Location: London, UK
|
Posted: Sun May 11, 2008 4:43 pm Post subject: |
|
|
| Code: | #IfWinActive, Windows Media Player
Space::Send,{Media_Play_Pause}
|
_________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
Slekvak Guest
|
Posted: Sun May 11, 2008 4:50 pm Post subject: |
|
|
| That did the trick. Thanks for the quick reply! |
|
| Back to top |
|
 |
Slekvak Guest
|
Posted: Sun May 11, 2008 4:52 pm Post subject: |
|
|
| Doesn't seem to work in fullscreen mode though. Any ideas? |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 753 Location: London, UK
|
Posted: Sun May 11, 2008 4:57 pm Post subject: |
|
|
In full screen mode my guess is the window title changes.
| Code: |
GroupAdd,mplayer,Windows Media Player
GroupAdd,mplayer,ahk_class WMPTransition
#IfWinActive,ahk_group mplayer
Space::Send,{Media_Play_Pause} |
This should now work. _________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
Slekvak Guest
|
Posted: Sun May 11, 2008 5:09 pm Post subject: |
|
|
| It worked when I had a fullscreen web-player, but now it doesn't work when I play a file (from my drive) in either fullscreen or windowed mode. |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 753 Location: London, UK
|
Posted: Sun May 11, 2008 5:12 pm Post subject: |
|
|
Check the window titles match, use the window spy to ensure the window titles are the same. _________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
Slekvak Guest
|
Posted: Sun May 11, 2008 5:17 pm Post subject: |
|
|
| Seems to work now.. Thank you! |
|
| Back to top |
|
 |
Slekvak Guest
|
Posted: Sun May 11, 2008 10:45 pm Post subject: |
|
|
When I put the code above my other hotkeys (like #f::run firefox), those don't work. When I put it below them, that one don't work. Any idea why that is?
| Code: | GroupAdd,mplayer,Windows Media Player
GroupAdd,mplayer,ahk_class WMPTransition
#IfWinActive,ahk_group mplayer
Space::Send,{Media_Play_Pause}
#f::run firefox
#b::run bitche
|
|
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 753 Location: London, UK
|
Posted: Sun May 11, 2008 11:09 pm Post subject: |
|
|
The #Ifwinactive specifies that all hotkeys from this point on should only work in the sepecified window.
If you put that as the first few lines then all hotkeys will only work in Media player. Either place the hotkeys below all the rest. Or Use
| Code: | | #Ifwinactive, ; Blank to turn off any limitations. |
_________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
Slekvak Guest
|
Posted: Sun May 11, 2008 11:28 pm Post subject: |
|
|
I'm sorry, but I can't get it to work.
I can't put the media player code at the bottom. Then it doesn't work. If i remove "vahk_group mplayer" from the IfWinActive line as you said, space doesn't work at all when other apps are in focus. What am I missing or not understand?
Thanks |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 753 Location: London, UK
|
Posted: Mon May 12, 2008 1:01 am Post subject: |
|
|
Your code should be as follows
| Code: | GroupAdd,mplayer,Windows Media Player
GroupAdd,mplayer,ahk_class WMPTransition
#IfWinActive,ahk_group mplayer ; All hotkeys from this point only work when media player is active
Space::Send,{Media_Play_Pause}
#Ifwinactive, ; All hotkeys from now on work in any window.
; All other hotkeys |
_________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
|