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 

Keyboard Media Keys (for USB HID devices!)
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
evl



Joined: 24 Aug 2005
Posts: 1239

PostPosted: Fri Dec 30, 2005 4:13 am    Post subject: Keyboard Media Keys (for USB HID devices!) Reply with quote

This set of 2 scripts and Micha's DLL file (thanks again Micha! couldn't have done it otherwise) allow you to replace the default actions of those media keys on some keyboards (like Play, Pause, Volume, etc) by defining your own actions.

This could probably also be used for other USB devices with very few changes.

I've included an instructions text file and examples/info at the top of each script file. Please take a look at them or else you probably won't get very far Smile

As an example of what it can do: I've currently remapped the volume wheel on my keyboard to adjust the master volume and display a simple On Screen Display (OSD) of the action and the volume level.

Download link (zip file):
http://autohotkey.net/~evl/KeyboardMediaKeys/Keyboard%20Media%20Keys.zip

Micha's original script thread:
http://www.autohotkey.com/forum/viewtopic.php?t=6367

It would be helpful to others if anyone using the script could report back their keyboard make/model and if they had to change the EditUsage and EditUsagePage values from the default (all described in the zip file).


p.s. Micha, I hope you don't mind me including your DLL file in the zip file?
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Fri Dec 30, 2005 2:04 pm    Post subject: Reply with quote

Nice post. This will be a great resource to those who want to customize their keyboard in ways the manufacturer doesn't support.
Back to top
View user's profile Send private message Send e-mail
Guest






PostPosted: Fri Dec 30, 2005 9:35 pm    Post subject: Reply with quote

Hi evl,
great job!

Feel free to use the dll and script in any way you desire!

Nice to see my little work be useful.

I have to mention that there could be a problem (somewhere).
I use a remote control. When I record the same key a lot of times the rawdata changes somehow.
When recording the key it shows the value "53570000". After a few times using it, the value changes to 53570053.
I guess there's something wrong with the conversion-routine or my dll. If I find something, I will post it.

Ciao
Micha
Back to top
evl



Joined: 24 Aug 2005
Posts: 1239

PostPosted: Fri Dec 30, 2005 11:39 pm    Post subject: Reply with quote

@Micha:
Thanks for all the work and making the dll available to use Very Happy

I haven't really seen any issues yet, but I've not been using it long enough to notice perhaps.
Back to top
View user's profile Send private message
Mathias
Guest





PostPosted: Mon May 07, 2007 5:50 pm    Post subject: Reply with quote

Wow! This is really awesome!
I tried it with my Logitech Cordless Keyboard (I wonder how it is named...) and it was super easy to set up and it detects every single of my 30+ Media Keys apart from the second enter key I got.
I'm using this now as a sleek replacement for the clunky Logitech driver.
I just wonder why noone answered in this thread since over a year? Is there another, more supported version out?

Thanks a lot!
Back to top
alcalina



Joined: 15 Oct 2007
Posts: 9

PostPosted: Tue Oct 23, 2007 6:39 pm    Post subject: Reply with quote

hi, i use and i liked very much

I just want put more than one line of code
but your program just accept one line
It is possible to put more than one code in the same line?

like change this

IfWinNotActive, ahk_class BSPlayer
WinActivate, ahk_class BSPlayer
IfWinActive, ahk_class BSPlayer
Send, {SPACE}

for something in one line only

Because if i change the in the file "Keyboard Media Keys Actions" and put several lines ( and work fine)
When i try to run "Keyboard Media Keys - detect keys" and add up a key
I have to go back to "Keyboard Media Keys Actions" and change again


tks very much and congratz for the excellent script
Back to top
View user's profile Send private message
evl



Joined: 24 Aug 2005
Posts: 1239

PostPosted: Thu Oct 25, 2007 4:35 am    Post subject: Reply with quote

I made it only use one line of code to keep things simple. You can change it manually as you did. One solution is to have the key (the single line of code) run another script which contains the longer code you want to run.
Back to top
View user's profile Send private message
tinaa



Joined: 25 Nov 2004
Posts: 41

PostPosted: Wed Jan 23, 2008 1:23 am    Post subject: Reply with quote

evl, thanks for the scripts. It looks like it will be useful. I have a Logitech Cordless Wave Desktop and haven't been able to map most of the keys using the conventional methods but they all seem to be detectable using this method.

One interesting key is called "Fn" which is used to activate special functions on the F1-F12 and Print Screen and Pause keys. I actually expected that this button wouldn't send any data itself, but it does. Your script detects the Fn key as soon as it is pressed. I'm wondering if there's a different code sent when the Fn key is pressed in combination with one of its target buttons or if it just sends the one code and the combination is interpreted by the Logitech driver?

Also, the Fn key is between the right Alt and Ctrl. I'd much rather it be the RWin key which I used extensively on my last keyboard as a modifier for other hotkeys. In your script, the action defined for the Fn key is executed as soon as the Fn key is pressed. Is there any way I could remap the Fn to Rwin? This would require, I think, detecting both the key down and key up events so that Rwin could be virtually pushed down then virtually released at the appropriate times.

Thanks!
Back to top
View user's profile Send private message
Jety
Guest





PostPosted: Fri Feb 01, 2008 10:04 am    Post subject: How to - Microsoft Natural Keyboard 4000 Reply with quote

Hi guys, thanks a lot both for AutoHotKey and for Keyboard Media Keys library.

If was trying to force my upper buttons of split Microsoft natural keyboard to do the activating of window based on its title.

There were two problems:
1) even if I uninstalled keyboard drivers, it was starting homepage when I hit Home special button
2) keys labeled 1 to 5 were detected with same key code in Keyboard media keys(0000004800000049)

So finally I achieved what I wanted by using original Microsoft drivers and assigning AHK scripts to the keys - read "Create shortcut to activate window by title" at http://jetensky.net/blog/2008/02/01/create-shortcut-to-activate-window-by-title/
Back to top
k3ph



Joined: 20 Jul 2006
Posts: 174

PostPosted: Tue Feb 05, 2008 2:02 pm    Post subject: Goldship Arch Slim Keyboard Office Hotkeys Map Reply with quote

Goldship Arch Slim Keyboard Office: Fn cannot be remapped, not a real key

Multimedia Keys Map:
http://docs.google.com/Doc?id=ddtm4wmw_116tj5svdvr


Last edited by k3ph on Sun Apr 13, 2008 4:05 pm; edited 1 time in total
Back to top
View user's profile Send private message
Frits Jan
Guest





PostPosted: Fri Feb 15, 2008 9:11 am    Post subject: Reply with quote

I used this script on my mac wireless bluetooth keyboard which I use on my pc. It works great for the eject and fn button.

However I wonder if it is also possible to remap the buttons instead to run a function. For example I would like my eject button to be delete.

Thanks
Back to top
Guest






PostPosted: Fri Feb 15, 2008 9:36 am    Post subject: Reply with quote

ok sorry this is easy of course:


4854: ; eject -> delete
send {delete}
Return
Back to top
reapur



Joined: 16 Jun 2008
Posts: 1

PostPosted: Mon Jun 16, 2008 9:48 pm    Post subject: Can I add volume bar graphs with these scripts? Reply with quote

Hi,
Thank you for these scripts. I have a dell multimedia keyboard that has worked on every computer for years, except for this HP laptop that I use at work. So I used these scripts to program the volume and the media keys.

I'm wondering, I've seen some scripts that have a Bar Graph type of display for the Volume, but no matter how I tried to add them to Keyboard Media Keys Actions.ahk I kept on getting errors.

Any thoughts on how this can be achieved?

Best Regards
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Tue Jun 17, 2008 4:57 pm    Post subject: Reply with quote

show how you are adding the code.

If you want, start a new topic in Ask for help, (with a link to this topic) and more people will see your question.
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
Dogmatix



Joined: 21 Aug 2008
Posts: 1

PostPosted: Thu Aug 21, 2008 7:50 pm    Post subject: Reply with quote

Hi,

I have been trying to use the tips in this thread to get the Eject button on my new compact keyboard (menat for a MAC, but I want to use it with my Shuttle PC) to do something useful. "Copy" would be useful, i.e. "send {LControl}{c}.

I cannot get it to work, though. I have used the "Keyboard Media Keys - detect keys" script, and it detects the Eject key with key code 53550048000000 (seems a bit long, can that be right?). I ran the "Keyboard Media Keys" script and it created "Keyboard Media Keys Actions", but when I run that, the Eject key is still ignored.

What could I be doing wrong, or failing to do right?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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