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 Previous  1, 2, 3  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
iforwms



Joined: 26 Aug 2008
Posts: 22

PostPosted: Fri Sep 12, 2008 8:05 pm    Post subject: Reply with quote

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 Sad

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

Thanks in advance
Back to top
View user's profile Send private message
Generic



Joined: 16 Sep 2008
Posts: 1
Location: Auckland, New Zealand

PostPosted: Tue Sep 16, 2008 10:59 am    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
Anon Hi Mom!
Guest





PostPosted: Tue Sep 16, 2008 7:54 pm    Post subject: Media Keys Reply with quote

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:
Code:
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. Shocked
There must be something I'm not understanding...
Back to top
DarkoDDio
Guest





PostPosted: Wed Oct 22, 2008 10:21 pm    Post subject: Re: Media Keys Reply with quote

Anon Hi Mom! wrote:
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:
Code:
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. Shocked
There must be something I'm not understanding...

same error, but on line 123
Back to top
elmulti



Joined: 14 Jan 2008
Posts: 35
Location: Germany

PostPosted: Fri Dec 05, 2008 4:44 pm    Post subject: Reply with quote

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:
Code:
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.


Last edited by elmulti on Tue Aug 25, 2009 9:11 pm; edited 1 time in total
Back to top
View user's profile Send private message
buglawton



Joined: 20 Aug 2009
Posts: 6

PostPosted: Tue Aug 25, 2009 7:31 pm    Post subject: Reply with quote

Anonymous wrote:
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?
Back to top
View user's profile Send private message
elmulti



Joined: 14 Jan 2008
Posts: 35
Location: Germany

PostPosted: Tue Aug 25, 2009 9:09 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
buglawton



Joined: 20 Aug 2009
Posts: 6

PostPosted: Thu Aug 27, 2009 9:23 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
elmulti



Joined: 14 Jan 2008
Posts: 35
Location: Germany

PostPosted: Thu Aug 27, 2009 6:56 pm    Post subject: Reply with quote

It is OK, that you don't see a tray icon. The script includes the line
Code:
#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
Code:
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.
Back to top
View user's profile Send private message
buglawton



Joined: 20 Aug 2009
Posts: 6

PostPosted: Fri Aug 28, 2009 6:13 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
elmulti



Joined: 14 Jan 2008
Posts: 35
Location: Germany

PostPosted: Sat Aug 29, 2009 3:53 pm    Post subject: Reply with quote

I'm glad that I could be of help. If you need help including the script in your own custom one, let me know.
Back to top
View user's profile Send private message
karvastor



Joined: 15 Sep 2009
Posts: 1

PostPosted: Tue Sep 15, 2009 12:26 pm    Post subject: Reply with quote

elmulti wrote:
The saved "Keyboard Media Keys Actions.ahk" then looks like this:
Code:
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?
Back to top
View user's profile Send private message
elmulti



Joined: 14 Jan 2008
Posts: 35
Location: Germany

PostPosted: Tue Sep 15, 2009 9:43 pm    Post subject: Reply with quote

karvastor wrote:
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.
Back to top
View user's profile Send private message
DaSilva



Joined: 30 Nov 2009
Posts: 2

PostPosted: Mon Nov 30, 2009 9:34 am    Post subject: Reply with quote

I tried to detect my Media: Mute (E0_20) button but it is not recognized.
What can I do?
Back to top
View user's profile Send private message
Michael@Oz



Joined: 08 Nov 2009
Posts: 233
Location: Canberra Oz

PostPosted: Wed Dec 16, 2009 1:49 am    Post subject: Re: Media Keys Reply with quote

Anon Hi Mom! wrote:
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:
Code:
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. Shocked
There must be something I'm not understanding...


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

Michael
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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