AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Play / Pause hotkey

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Johnny B
Guest





PostPosted: Mon Apr 02, 2007 1:49 pm    Post subject: Play / Pause hotkey Reply with quote

Hi everybody. I am completely new to AutoHotkey and to scripting as well and even after reading as much as possible here on the forums, FAQ etc. I am still lost. I would like to solve this "problem"...

Keyboard in my office does not have any multimedia keys and my favourite media player (J. River Media Center) has no global hotkeys (like seen in Winamp) and I could not find any third-party plugin which would help.

Please is there any way how could I control the program (Play / Pause, Next, Prev) via some keyboard shortcuts?

Thanks for any idea.
Back to top
Helpy
Guest





PostPosted: Mon Apr 02, 2007 1:58 pm    Post subject: Reply with quote

Welcome!

Alas, it will be hard to help you, I suppose lot of people don't have your player (first time I hear of it) and we don't even have a download link, if ever available.

It depends on the application: if it is a classical Windows program, use the Window Spy on control and use ControlSend command to act on them.
If it is skinned (likely for such application), it can be harder...
I know it have been done for Winamp with SendMessage, you might want to search for it in the forum.
Back to top
Johnny B
Guest





PostPosted: Mon Apr 02, 2007 2:23 pm    Post subject: Reply with quote

Hi Helpy. Thanks for the comment. Well I would not say that J. River Media Center is so "unkown" - it's been around for a while (the last version is 12 already) and it is pretty good especially when dealing with lots LOTS of files (the Media Library in this SW is really great).
The link is here:
http://www.jrmediacenter.com/

It is a "classical Windows program" (although to be honest I am not sure what exactly you mena by this Smile and it works with multimedia keyboards.

I do not know Window Spy and its puprose - neither I understand what is ControlSend command good for - sorry... Embarassed

It uses skins - if this is what you mean...

I tried to search the forums but as I said I am really confused... Embarassed
Back to top
Helpy
Guest





PostPosted: Mon Apr 02, 2007 3:01 pm    Post subject: Reply with quote

I just meant it might be less known that, say, VLC, Winamp or Media Player Classic. At least because it is shareware, I suppose freewares are more popular, even if less powerful than your player.

I fear that, unless somebody is very bored, not many people will install a 15MB software (not so big for a media player, though) just to see how to automate it.

By "classical", I meant "non-skinned", ie. using standard controls like non-graphical buttons or standard menus, as seen in Notepad or WordPad, for example.
A skinned application is harder to automate, because often AutoHotkey only see one opaque window where the controls are drawn, not a collection of controls on which it can act.

BTW, ControlSend command is in the manual, you can look it up in the index tab of the CHM shipped with the program. And Window Spy is shipped too with AutoHotkey.exe, that's AU3_Spy.exe which is also available in the context menu of any running script.

A workaround might be to use ImageSearch, but it works only if the MC is active... But I scanned the MC FAQ, and it seems it works with remote controls, so it should accept some input.
Back to top
Helpy
Guest





PostPosted: Mon Apr 02, 2007 3:05 pm    Post subject: Reply with quote

I found an interesting page: Media Center Automation. It can be automated via COM.
Until recently, it would have been outside of scope of AutoHotkey, but some people found how to use Com within AHK, so it can be done without much sweat and tears...
I won't work on this, but I hope I gave some keys to anybody willing to help.
Back to top
Johnny B
Guest





PostPosted: Wed Apr 04, 2007 9:05 am    Post subject: Reply with quote

>Helpy
Thanks very much indeed for the information and ideas. Unfortunately all this is far too "technical" for me (I am not a programmer myself) and it all makes me confused even more and more... Confused
I only wanted to know if there is some easy way how to control the program...
Nevertheless I still wonder - isn't there any way how to emulate "Play / Pause" button seen on the multimedia keyboards? I think this should be easier solution and it should work for me in this case...

Thanks again
Back to top
skwire



Joined: 18 Jan 2006
Posts: 273
Location: Conway, Arkansas

PostPosted: Thu Apr 05, 2007 10:45 am    Post subject: Reply with quote

This ought to get you started. I've used the standard media keys but you could change them to any hotkey combo you want.

Code:
DetectHiddenWindows, On

Media_Play_Pause::
{
    IfWinNotExist ahk_class MJFrame
    {
        Return
    }
    ControlSend, ahk_parent, ^p  ; Play/Pause
}
Return

Media_Stop::
{
    IfWinNotExist ahk_class MJFrame
    {
        Return
    }
    ControlSend, ahk_parent, ^s  ; Stop
}
Return

Media_Next::
{
    IfWinNotExist ahk_class MJFrame
    {
        Return
    }
    ControlSend, ahk_parent, ^n  ; Next track
}
Return

Media_Prev::
{
    IfWinNotExist ahk_class MJFrame
    {
        Return
    }
    ControlSend, ahk_parent, ^l  ; Previous track
}
Return

Volume_Mute::
{
    IfWinNotExist ahk_class MJFrame
    {
        Return
    }
    ControlSend, ahk_parent, ^m  ; Mute
}
Return

Volume_Up::
{
    IfWinNotExist ahk_class MJFrame
    {
        Return
    }
    ControlSend, ahk_parent, ^{NumpadAdd}  ; Volume up
}
Return

Volume_Down::
{
    IfWinNotExist ahk_class MJFrame
    {
        Return
    }
    ControlSend, ahk_parent, ^{NumpadSub}  ; Volume down
}
Return
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
FatZgrED



Joined: 19 Oct 2008
Posts: 7
Location: Kielce, Poland

PostPosted: Tue Aug 25, 2009 9:42 pm    Post subject: Sorry for raising long dead thread :) Reply with quote

Solution http://www.autohotkey.com/forum/viewtopic.php?p=291366
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group