Sign in to follow this  
Followers 0
gagan512

Keyboard Media Buttons

7 posts in this topic

Hi,

I had posted this in another topic but it was suggested that I start a new topic.

Here's what i want:

----------------------------------------------------------------------------------------------------------------------------

i had a question relating 'multimedia' keys on keyboards. is there a way to read the raw hex code that they return when pressed?

Reason i want to know: my multimedia keyboard has media buttons like "play/pause/next track....." but they only work with media player. i want them to work with winamp, and other media players. so i wanted to make an autoit script that reads the key hex code.

all the scripts i've seen around here seem to involve the following algorithm:

----------------------------------------------------------

If (blah pressed)

You pressed (blah)

Case

<<Look-up-table defining all the keys>>

...

...

------------------------------------------------------------

I wanted one specifically for the multimedia keys,, any ideas ?

thanks

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

maybe the "_IsPressed" function will help a little...

Check the beta helpfile or here

Edited by Paulie

Share this post


Link to post
Share on other sites

In Winamp, just go into the preferences, go to Global Hotkeys and enable them. Works perfect with my Logitech G15.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Use this, if you can't find them, change the range from the For loop in the function.. :D:

#include <misc.au3>

While 1
    $p = Pressed()
    If $p <> 0 Then
        MsgBox(0, @ScriptName, "Hex value of key pressed : " & $p & @CRLF & "Decimal value of key pressed : " & Dec($p) )
    EndIf
WEnd

Func Pressed()
    For $x = 400 to 800
        If _IsPressed(Hex($x,2)) Then
            Return Hex($x)
        EndIf
    Next
    Return 0
EndFunc
Edited by Manadar

Share this post


Link to post
Share on other sites

In Winamp, just go into the preferences, go to Global Hotkeys and enable them. Works perfect with my Logitech G15.

Winamp has a option to customly set Hotkeys, you can also use MEDIA_* there.

I dont want this for Winamp alone, want it to be globally available.

I'm actually designing the keyboard myself on a USB enabled microcontroller. I have "scan codes" that i program on the chip, but since it a "HID" application, windows does its own thingamagic and converts them to ASCII.

I'll look up the IsPressed options, thanks guys

Share this post


Link to post
Share on other sites

no luck yet with this...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0