Jump to content

Recommended Posts

Posted

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

Posted (edited)

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

Check the beta helpfile or here

Edited by Paulie
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
Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...