AutoHotkey Community

It is currently May 27th, 2012, 1:24 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 398 posts ]  Go to page Previous  1 ... 12, 13, 14, 15, 16, 17, 18 ... 27  Next
Author Message
 Post subject: Re: can someone help?
PostPosted: August 6th, 2010, 3:17 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
Hey cracksloth,

cracksloth wrote:
Also, it took me forever to figure out that the remote example in the second post no longer works with the AHKHID version in the first post because of the recent addition of the prefix AHKHID rather than the old prefix HID.

You're right. Really sorry about that! I fixed the script.

As for your code, your main problem lies here:

Code:
    iKey := AHKHID_GetInputData(lParam, uData)
    SendInput %iKey% "{Enter}"


Compare this to the code found in the remote script:
Code:
        ;Get data
        iKey := AHKHID_GetInputData(lParam, uData)
       
        ;Check for error
        If (iKey <> -1) {
           
            ;Get keycode (located at the 6th byte)
            iKey := NumGet(uData, 5, "UChar")
           
            ...


AHKHID_GetInputData only puts the data in the variable uData. It doesn't return the key pressed in iKey, so doing SendInput %iKey% is not what you want to do.

If you want to extract the key from uData, you need to find out which byte(s) it is in uData (in my example, it was the 6th byte).

If you just want to spit out all of uData, then you can do something like this:
Code:
    ;Get data
    iKey := AHKHID_GetInputData(lParam, uData)
   
    ;Check for error
    If (iKey <> -1) {
       
        ;iKey contains the length of uData
        SendInput % Bin2Hex(&uData, iKey) "{Enter}"
    }

which is exactly what I did when I modified Example 2 for the 3rd step of my tutorial.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: thanks!
PostPosted: August 6th, 2010, 4:35 pm 
thanks so much for your patience and help! i'm probably attempting some modifications that are beyond my skill level! as for the changes, i actually tried that first but I get the following error at that line:

Error: Call to nonexistent function

Am I missing an include? Again, in case I'm missing something, it is pasted below:

Code:
#Include AHKHID.ahk

;Create GUI to receive messages
Gui, +LastFound
hGui := WinExist()

;Intercept WM_INPUT messages
WM_INPUT := 0xFF
OnMessage(WM_INPUT, "InputMsg")

;Register the keyboard TLC with RIDEV_INPUTSINK (so that data is received even in the background)
r := AHKHID_Register(65468, 136, hGui, RIDEV_INPUTSINK)

Return

InputMsg(wParam, lParam) {
    Local devh, iKey, sLabel
    Critical
   
    ;Get handle of device
    devh := AHKHID_GetInputInfo(lParam, II_DEVHANDLE)
   
    ;Get device name
    devname := AHKHID_GetDevName(devh, True)
   
    ;Make sure it's from my keyboard
    If (devname <> "\\?\HID#VID_0C16&PID_0002&MI_01&Col05#7&2658d195&0&0004#{4d1e55b2-f16f-11cf-88cb-001111000030}")
        ;Get data
        iKey := AHKHID_GetInputData(lParam, uData)
        SendInput % Bin2Hex(&uData, iKey) "{Enter}"
        Return
}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 6th, 2010, 6:08 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
You need Bin2Hex (which is part of Example 2 as well).
Also, you need to put braces after your if statements to have more than one line belong to it (otherwise it'll only own the first line). Read here and, more generally, here.

Hope this helps!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 7th, 2010, 9:14 pm 
Hi there, I'm trying to simulate the keypress of the backlit keyboard button on my keyboard.

It's on the F6 key, pressing it normally acts as the backlit keyboard function (turns it on/off/half power), and pressing FN + F6 makes it act like a regular F6 key. Using example 2 however, I was unable to make the button register, with or without using the FN key.

For the record, the FN key does not register either. The laptop I am using is the dell studio 15.

Any help would be greatly appreciated.

Thanks. :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 7th, 2010, 9:17 pm 
Oh, I forgot to mention. It might (not sure about this) be useful for you guys to know that when I press the backlit keyboard button (as the backlit function, not as the F6 key with FN), the active window seems to lose focus for a second - and the class " #32770" becomes the active window in windowspy. Not sure if this helps.

Anyways, I hope someone can shed some light on this. I appreciate your time, thanks again.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 9th, 2010, 3:09 am 
Studio wrote:
Oh, I forgot to mention. It might (not sure about this) be useful for you guys to know that when I press the backlit keyboard button (as the backlit function, not as the F6 key with FN), the active window seems to lose focus for a second - and the class " #32770" becomes the active window in windowspy. Not sure if this helps.

Anyways, I hope someone can shed some light on this. I appreciate your time, thanks again.


Ended up simulating the keypress by using control send with windows mobility center slider that controls the backlit keyboard.

Thanks for anyone who considered though. :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 9th, 2010, 9:28 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
Hello Studio,

Sorry for the late reply! Glad to hear you figured out a workaround.

Quote:
I'm trying to simulate the keypress of the backlit keyboard button on my keyboard.

It's on the F6 key, pressing it normally acts as the backlit keyboard function (turns it on/off/half power), and pressing FN + F6 makes it act like a regular F6 key. Using example 2 however, I was unable to make the button register, with or without using the FN key.

It sounds like this is something that happens at a lower level than what AHKHID can access. If you've already tried accessing HID devices other than the keyboard, then I don't think there's much else you can try!
According to the famous Mystery of the Fn key tutorial, you might be able to get something by using Usage/UsagePage 1/12.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 22nd, 2010, 11:29 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
I added support for AHK_L 64-bit. I also updated the example scripts so that they work with either version of AHKHID.

As a side note, I was torn between releasing a universal AHKHID instead of two separate ones. In the end I decided against it to keep it clean and I suppose (if you're like me) people keep their x64 scripts apart from their x86 ones.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2010, 2:18 pm 
I have a device:
VID:18EF
PID:E015
Revision:0000

Now i will write this 01 06 F1 1B 1B 00 10 00 00 00 00 to the HID-Device.

How can i do this?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2010, 9:14 pm 
Offline

Joined: October 20th, 2010, 11:48 am
Posts: 4
Great stuff!

I was wondering how I could map a simple Run C:\1.pls to number button 1 and Run C:\2.pls to number button 2?

VLC is associated with .pls so it will just start certain internet radio stations depending on which .pls is called.

Are there direct buttons to map for the 1-9 number keys? I see your code is a bit more complicated and I'm not a big programmer.

Something like this? Numberbutton1::Run, C:\1.pls


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 9th, 2010, 1:58 pm 
Offline

Joined: January 15th, 2007, 2:37 pm
Posts: 573
It took me a while to figure out how to get this working but I figured out an easy way to find your Gosub Labels or simply the data the script is getting from your remote.

On page 1 of this topic, 2nd post Tutorial, #4 Creating A Script " TheGood" Shows us the script he uses to control media players. Toward the bottom find the IsLabel and Gosub commands, comment them out and add this message box command under them.

Code:
;If IsLabel(sLabel)
;Gosub, %sLabel%
MsgBox,  Prefix = %sPrefix%`nKey = %iKey%`nLabel = %sLabel%

Prefix = What media player or window is in focus when the button was pushed.
Key = What the script is getting from your remote.
Label = The combination of the two which is the names for your Gosubs.

Run the script and for every button press you get a pop up telling you what your Label is. Notice that the label changes if you have media players in focus when pushing a button. This was a brilliant idea to make the remote context sensitive, ie. only work on the window in focus. So you will need to have your media players in focus to get the correct Labels for them.

For me it was necessary to set the NumGet offset to 1 but play with this to see what works best for your remote.
Code:
iKey := NumGet(uData, 1, "UChar")


Don't forget to go through the rest of the script and change it to recognize your remote.

Thank you TheGood for creating the wonderful script.


Last edited by specter333 on November 9th, 2010, 2:27 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 9th, 2010, 2:11 pm 
Offline

Joined: January 15th, 2007, 2:37 pm
Posts: 573
rcll wrote:
Great stuff!

I was wondering how I could map a simple Run C:\1.pls to number button 1 and Run C:\2.pls to number button 2?

VLC is associated with .pls so it will just start certain internet radio stations depending on which .pls is called.

Are there direct buttons to map for the 1-9 number keys? I see your code is a bit more complicated and I'm not a big programmer.

Something like this? Numberbutton1::Run, C:\1.pls


In TheGoods tutorial script just add the commands to your Gosubs. It would look something like this.
Code:
VLC_1: ;You will have to figure out what label goes here.
Run, C:\1.pls ; I believe you can start a playlist like this.
Return

Remember that VLC would have to be the active window for this to work. If you want to always have the button active instead of VCL_1 use DEFAULT_1 which will work unless one of the media player is active.

Good luck


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 15th, 2010, 3:37 pm 
Offline

Joined: November 14th, 2010, 2:09 pm
Posts: 10
Hi

please help I tryed runninh AHKHID nothing happens, the script just stop immidiatly

I tryed to run example 1 2 3 I get a error message "non existing script AHKHID"

Please tell me what I am missing out

I read the documentation try the tutorial but cannot find any indication on what to do or what I am doing wrong

thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 15th, 2010, 5:41 pm 
Offline

Joined: November 14th, 2010, 2:09 pm
Posts: 10
ok I managed to get it working, in fact all I was not doing is copy paste of example into AHKHID

But no change for me my device is not listed as a HID device

Dose anybody have an idea how I could get hold of my device?

thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 15th, 2010, 10:57 pm 
Offline

Joined: January 15th, 2007, 2:37 pm
Posts: 573
I'll try to give you a hand since it looks like this topic isn't viewed much. What type of device is it your trying to find what OS are you using and what are you trying to do with it when you've found it?

I don't want to take away from this great app but I would suggest using EventGhost to at least find your device and may be better for using them also.
[url]"http://www.eventghost.org/forum/"[/url]

It sees my Gyromote which is a very odd input device and it sees all the buttons where HIDAHK misses a few. It can also see many other types of input devices if it's not an HID class device. And it's also easy to assign actions to the buttons with many, many included preset actions. It's possible there is already a plugin for your device.

So that would be my first suggestion. If that won't work for you then I can try to help with this app. Start by answering the above questions.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 398 posts ]  Go to page Previous  1 ... 12, 13, 14, 15, 16, 17, 18 ... 27  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bon, Yahoo [Bot] and 14 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group