Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Keyboard Media Keys (for USB HID devices!)


  • Please log in to reply
43 replies to this topic
iforwms
  • Members
  • 22 posts
  • Last active: Jan 25 2010 07:14 PM
  • Joined: 26 Aug 2008
Hey, script looks good, unfortunately, when I try and run it I get a missing mfc71.dll error. I have downloaded a copy and placed it in my system and system32 folders, but when I try and register the dll I get a LoadLibrary failed message :(

Any ideas? Or just the key codes for a Logitech LX710 :p

Thanks in advance

Generic
  • Members
  • 1 posts
  • Last active: Sep 10 2009 11:49 AM
  • Joined: 16 Sep 2008
I'm having the same problem. Noone out there with any ideas? This dll/script seems like the only way to identify and map my fn & eject keys on my apple keyboard, and in accordace with murphy's law it doesn't work!

Anon Hi Mom!
  • Guests
  • Last active:
  • Joined: --
Hi

I was trying to use this script to map the keys of a remote control I bought with Windows MCE. I fact MCE doesn't allow me to use the media keys with media player classic, and I don't want to use WMP.

But when using the AutoHotkeyRemoteControlDLL.ahk I get an error: as soon as i select any device, I'm greeted by autohotkey telling me:
Error: This DllCall requires a prior VarSetCapacity. The program is now unstable and will exit.

It's ridiculous. The error is notified on line 99 while the assertion requested is at line 97. :shock:
There must be something I'm not understanding...

DarkoDDio
  • Guests
  • Last active:
  • Joined: --

Hi

I was trying to use this script to map the keys of a remote control I bought with Windows MCE. I fact MCE doesn't allow me to use the media keys with media player classic, and I don't want to use WMP.

But when using the AutoHotkeyRemoteControlDLL.ahk I get an error: as soon as i select any device, I'm greeted by autohotkey telling me:

Error: This DllCall requires a prior VarSetCapacity. The program is now unstable and will exit.

It's ridiculous. The error is notified on line 99 while the assertion requested is at line 97. :shock:
There must be something I'm not understanding...

same error, but on line 123

elmulti
  • Members
  • 35 posts
  • Last active: Nov 01 2009 11:55 PM
  • Joined: 14 Jan 2008
Hi,
this Script looks pretty useful to me. I tried it with my Cyberlink Remote which shows up as an HID. (Well, actually it show up as three HIDs in device manager.) And most of the buttons are detected nicely.
However, some buttons don't work yet. They are detected, but the script messes up, so hopefully somebody can help me with this.

If I use the Detect-Keys-Script for the enter-button or the number-buttons, then the button is detected, but in the appearing window the field that normally shows "AutoHotkey command to run" is missing. The saved "Keyboard Media Keys Actions.ahk" then looks like this:
Key_Action_Check:
  IfEqual, Vals, 00000052505752575455505753000000000000000000000000000000...
GoSub 00000052505752575455505753000000000000000000000000000000...
Return



00000052505752575455505753000000000000000000000000000000...; Enter-Button
  AutoHotkey command to run
  Return

The detected code is way too long.
I'm using Vista 32bit and the latest AutohotkeyRemoteControl.dll that I could find. The older one asked for mfc71.dll, but the newer one works.

Any ideas on this?

Edit: Sorry for the extremely long lines. How can I fix them?

Edit2: This is what AutoHotkeyRemoteControlDLL.ahk tells me about the enter-button:
MakeCode: 28
Flags: 0
Key: 13
Msg: 256
Extrainfo: 4291023949

Edit3: I finally cropped the long lines.

buglawton
  • Members
  • 6 posts
  • Last active: Mar 15 2010 05:20 PM
  • Joined: 20 Aug 2009

ok sorry this is easy of course:


4854: ; eject -> delete
send {delete}
Return


I've been following this thread and the Autohotkey FAQ to get my Eject button to server as a 'Forward Delete' button. This on an Apple Aluminium mini Keyboard connected to a straight XP machine. Autohotkey is already working nicely to do a couple of key swaps for this keyboard.

Using the great little Keyboard Media Keys - detect keys.ahk script, I am told that this media key has the code 4852. (Interestingly, the Eject button is the only button detected by above mentioned script).

So I added the below script to my key swapping script that already works:

Key_Action_Check:
IfEqual, Vals, 4852, GoSub 4852
Return
4852: ; Eject
send {Delete}
Return

...it seems to be accepted by AHK, but does nothing!

is it obvious to anyone where I'm going wrong?

elmulti
  • Members
  • 35 posts
  • Last active: Nov 01 2009 11:55 PM
  • Joined: 14 Jan 2008
Your code seems to be OK, but you don't seem to be using it correctly.
You should really take the time to read through the INSTRUCTIONS.txt file and the first few lines of the file "Keyboard Media Keys.ahk".

You need to run the "Keyboard Media Keys.ahk" file in order to make any of this work. If you just copied those 6 lines into your own script, then they will in fact do nothing at all. Try including your lines in "Keyboard Media Keys Actions.ahk" and run the main script, then your button should work like you want it to.

buglawton
  • Members
  • 6 posts
  • Last active: Mar 15 2010 05:20 PM
  • Joined: 20 Aug 2009
This gets me a bit closer... using the above advice, when I run the "Keyboard Media Keys.ahk" script I can see it's pulling in my subroutine from "Keyboard Media Keys Actions.ahk" because when I forgot to add the action like this:

4852: ; Eject
Return

it correctly warned me that no action was defined.

So I changed it to:

4852: ; Eject
send {Delete}
Return

now, the script starts up, no error, is silent BUT not only does the Eject fail to do anything, I also noticed that the AHK system tray icon does not appear though an Autohotkey process is visible in Task Manager 2nd tab..

Is this to do with the DLL file? Does it need to be in a special folder? Mine is in the same folder where I run the script from.

elmulti
  • Members
  • 35 posts
  • Last active: Nov 01 2009 11:55 PM
  • Joined: 14 Jan 2008
It is OK, that you don't see a tray icon. The script includes the line
#NoTrayIcon
which hides it. You can put a ";" at the beginning of this line or remove it, to see the tray icon.
In addition I suggest you try writing something like
MsgBox Test!
as the action for your button. This way it's easier to get the result by trial and error.
The DLL should be in the same folder as the script files, this doesn't seem to be your problem.

If you still can't get it to work, please post your whole "Keyboard Media Keys Actions.ahk" file as code here.

buglawton
  • Members
  • 6 posts
  • Last active: Mar 15 2010 05:20 PM
  • Joined: 20 Aug 2009
I put the test message in and could see the key is being detected... so I commented it out and uncommented my original send delete command... lo and behold it now works! Even the Ctrl-Alt-Delete key combo now works on XP using the Apple mini keyboard, using Eject ast the substitute key for Delete.

Cool!

And many thanks for the help.

elmulti
  • Members
  • 35 posts
  • Last active: Nov 01 2009 11:55 PM
  • Joined: 14 Jan 2008
I'm glad that I could be of help. If you need help including the script in your own custom one, let me know.

karvastor
  • Members
  • 1 posts
  • Last active: Sep 15 2009 02:02 PM
  • Joined: 15 Sep 2009

The saved "Keyboard Media Keys Actions.ahk" then looks like this:

Key_Action_Check:
  IfEqual, Vals, 00000052505752575455505753000000000000000000000000000000...
GoSub 00000052505752575455505753000000000000000000000000000000...
Return



00000052505752575455505753000000000000000000000000000000...; Enter-Button
  AutoHotkey command to run
  Return

The detected code is way too long.


emulti, i'm getting really long codes too, to the point where the script terminates, probably because that's just too big of a name for a label... how did you solve this?

elmulti
  • Members
  • 35 posts
  • Last active: Nov 01 2009 11:55 PM
  • Joined: 14 Jan 2008

emulti, i'm getting really long codes too, to the point where the script terminates, probably because that's just too big of a name for a label... how did you solve this?

I didn't solve that problem. I used Michas DLL & script to change a lot of buttons, but I couldn't get the ones with the really long codes to work in AHK.

DaSilva
  • Members
  • 2 posts
  • Last active: Dec 16 2009 10:57 AM
  • Joined: 30 Nov 2009
I tried to detect my Media: Mute (E0_20) button but it is not recognized.
What can I do?

  • Members
  • 234 posts
  • Last active: Dec 30 2011 11:24 PM
  • Joined: 08 Nov 2009

Hi

I was trying to use this script to map the keys of a remote control I bought with Windows MCE. I fact MCE doesn't allow me to use the media keys with media player classic, and I don't want to use WMP.

But when using the AutoHotkeyRemoteControlDLL.ahk I get an error: as soon as i select any device, I'm greeted by autohotkey telling me:

Error: This DllCall requires a prior VarSetCapacity. The program is now unstable and will exit.

It's ridiculous. The error is notified on line 99 while the assertion requested is at line 97. :shock:
There must be something I'm not understanding...


I'm getting similar, I checked the script and it has VarSetCapacity prior to the DLLCall :?, anyone know what's happening?

Michael