AutoHotkey Community

It is currently May 26th, 2012, 8:58 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 398 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10 ... 27  Next
Author Message
 Post subject:
PostPosted: June 21st, 2009, 4:09 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
What you need is some kind of filtering.
I am working on a modified version of Example 2 that will allow this, but for now you'll have to do it yourself (I doubt I'll be releasing it anytime soon). It shouldn't be too hard. You'll have to add a code section in the InputMsg that will discard messages based on certain criteria, which you'll have to determine.

Don't forget that you can deregister devices. Therefore, what you might want to do is to register the device, and then prep the deregister call and keep the mouse on the Call button. And then click it as soon as you press a button on your HID. This way, the press should be near the bottom of the input list.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: June 24th, 2009, 12:01 pm 
Offline

Joined: March 8th, 2009, 12:30 am
Posts: 9
bidomo wrote:
bxr wrote:
In another words, how do you disable the original key presses of the MCE remote such as 0-9 numbers and replace them?


You can find detailed info (which I'd tried to explain before in page 5) here http://mediacenterguides.com/sites/default/files/IRCodes_ReportMappingTable_InputINF.pdf (the pdf is not mine)

this reg file will disable 0-9 for you...




Tried it. It requires restart of the system though.
The problem is that it doesn't allow to catch the presses in AHKHID as well or am I missing something here?


Report this post
Top
 Profile  
Reply with quote  
PostPosted: June 25th, 2009, 8:15 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
bxr wrote:
Tried it. It requires restart of the system though.
The problem is that it doesn't allow to catch the presses in AHKHID as well or am I missing something here?


What bidomo showed you is only to disable the keypresses generated by the remote. You can now capture the buttons with AHKHID in the same way I showed in the tutorial.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Raw Data
PostPosted: June 26th, 2009, 4:27 am 
Offline

Joined: June 6th, 2009, 2:07 pm
Posts: 9
Location: Here
Ive managed to find the raw data for each of the other parts on the Joystick. I'd like to be able to use them to make certain functions active and others silent for example if the tuner dial is set to "11" Joy12 brings up firefox but if Tuner dial is set to "22" Joy12 would bring up a windows calculator. In short I'm not really sure where to go next from here.

Image

_________________
In the beginning the Universe was created.
This has made a lot of people very angry and has been widely regarded as a bad move.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Raw Data
PostPosted: June 26th, 2009, 2:59 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
Xizzzy wrote:
I'd like to be able to use them to make certain functions active and others silent for example if the tuner dial is set to "11" Joy12 brings up firefox but if Tuner dial is set to "22" Joy12 would bring up a windows calculator. In short I'm not really sure where to go next from here.

There are different ways you can do this. As long as you're able to detect in which position the dial is, you shouldn't have any problem. The obvious thing you could do here is, in your InputMsg() function, keep a global variable up-to-date with the position of the dial. And then in your sub for Joy12, simply use a set of Ifs to do different actions depending on the value of the global variable.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Making progress
PostPosted: June 27th, 2009, 7:55 pm 
Offline

Joined: June 6th, 2009, 2:07 pm
Posts: 9
Location: Here
So far Ive been able to get responses from the input codes I have and things are progressing smoothly. However, do I need two scripts to have the input recognized and acted on from 2 different positions in the code. If I'm having it keep an eye on the 7th byte do I need a separate script to also keep an eye on the 15th byte as well? Also how would I go about setting up the Global that could keep up to date on the position of the dial and then how would I set up the script to act differently from the button the ifs are simple enough but using "Default_0" as if it were a part of the "send {enter}" commands doesn't seem to work. I'm probably missing something with that but I'm still fairly new to autohotkey so I'm learning as I go =3

Furthermore, if I do have one script that can act depending on how two byte positions are can I have them act together?

ie. if byte 5 is decimal value 12 and byte 7 is decimal value 16 how would I setup a script to use the value of byte 5 to control the result from byte 7

_________________
In the beginning the Universe was created.
This has made a lot of people very angry and has been widely regarded as a bad move.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2009, 2:01 am 
Offline

Joined: February 5th, 2009, 9:12 am
Posts: 59
That joystick looks very cute, I'll try to get one


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Lights and HID
PostPosted: July 7th, 2009, 11:52 am 
Offline

Joined: June 6th, 2009, 2:07 pm
Posts: 9
Location: Here
I've got the basic idea behind the methods to use my HID device with your methods and I thank you for them ^_^ I still have a few other concepts to learn at this point about using two different bytes together to produce separate results but that can wait I think. Now, I'd like to tap into the ability to control the lights that are under the buttons =) The method below is written by the guy who created the drivers that allow me to use this Joystick on my PC instead of where its supposed to be used on an Xbox. The problem is I have absolutely no idea where to begin even trying to make that work =\

Image

Also Thx I love my Joystick its a lot of fun ^_^ although the original game wasn't that great to be honest.

_________________
In the beginning the Universe was created.
This has made a lot of people very angry and has been widely regarded as a bad move.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2009, 4:21 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
I'm glad you're figuring stuff out!
Unfortunately, AHKHID is only meant to receive data from HID devices. It doesn't have the ability to actually communicate with the device, which is what you're looking to do. I have no idea how that would work.
Try posting in the Ask For Help section and see if anyone can translate the code to AHK for you!


Report this post
Top
 Profile  
Reply with quote  
PostPosted: July 21st, 2009, 12:52 pm 
Offline

Joined: April 22nd, 2008, 7:13 pm
Posts: 82
I'm a special ed teacher and bought this roll up drum kit

http://www.dreamcheeky.com/index.php?pa ... uct&pid=33

So i could not only use it in class as it is but also however the heck I want to so I can meet the needs of my students. I needed to be able to program whatever sounds/keys/mouse moves etc I wanted so here is my first test script. (still need to have AHKHID.ahk in the same directory)
I was surprised when it wasn't recognised as a joystick. Also, I don't fully understand everything that's going on in this script but it works so far.

Code:
;Must be in auto-execute section if I want to use the constants
#Include %A_ScriptDir%\AHKHID.ahk

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

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

;Register Remote Control with RIDEV_INPUTSINK (so that data is received even in the background)
d := HID_Register(65440, 1, hGui, RIDEV_INPUTSINK)

Return

InputMsg(wParam, lParam)
{
    Local devh, iKey, sLabel
   
    Critical
   
    ;Get handle of device
    devh := HID_GetInputInfo(lParam, II_DEVHANDLE)
   
   ;Get data
        HID_GetInputData(lParam, uData)   
   iKey := NumGet(uData, 0, "UInt")
   sLabel := "Drum" . iKey
   if (ikey > 0 AND ikey = 2048 OR ikey = 512 OR ikey = 4096 OR ikey = 1024 OR ikey = 8192 OR ikey = 256)
    Gosub, %sLabel%
   ;msgbox, %sLabel%
}    
Drum2048:
soundplay, fart1.wav
return

Drum512:
soundplay, fart2.wav
return

Drum4096:
soundplay, fart3.wav
return

Drum1024:
soundplay, fart4.wav
return

Drum8192:
soundplay, fart5.wav
return

Drum256:
soundplay, fart6.wav
return


The sound effects are a bit "cheeky" (I'm sorry for that one...) but they are just the beginning!

Here's a zip with the "hole" package (teeheehee)
http://www.autohotkey.net/~evandevon/Drumkit%201.zip
Download this and take it around on a usb key so that you don't need to install the drivers/software for this thing.

_________________
Inventing problems that need solutions...

Open Communicator
MouseTrainer


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 10th, 2009, 6:49 pm 
Offline

Joined: February 7th, 2009, 5:37 am
Posts: 43
I bought multimedia IR remote controller with USB receiver
Image
6 new items appears in the Device Manager right after connecting USB receiver
Image
This remote control operates both the keyboard and mouse
Code:
/*
http://img142.imageshack.us/img142/8342/remote.png
+--------------------+--------------------+--------------------+
| Remote key         | Keyboard mode      | Mouse mode         |
+--------------------+--------------------+--------------------+
| power              | Power button                            |
+--------------------+-----------------------------------------+
| close              | LAlt + F4                               |
+--------------------+-----------------------------------------+
| tv/dvr             | LCtrl + LShift + LAlt + 2               |
+--------------------+-----------------------------------------+
| print              | LCtrl + LShift + LAlt + H               |
+--------------------+-----------------------------------------+
| music              | LCtrl + LShift + LAlt + 3               |
+--------------------+-----------------------------------------+
| dvd/menu           | LCtrl + LShift + LAlt + 1               |
+--------------------+-----------------------------------------+
| pictures           | LCtrl + LShift + LAlt + 4               |
+--------------------+-----------------------------------------+
| videos             | LCtrl + LShift + LAlt + 5               |
+--------------------+--------------------+--------------------+
|                    |         Up         |                    |
| joystick           | Left         Right | Move mouse pointer |
|                    |        Down        |                    |
+--------------------+--------------------+--------------------+
| back               | Browser Back       | Left mouse button  |
+--------------------+--------------------+--------------------+
| tab                | Tab                | Right mouse button |
+--------------------+--------------------+--------------------+
| ok                 | Enter                                   |
+--------------------+-----------------------------------------+
| play/pause         | LCtrl + P                               |
+--------------------+-----------------------------------------+
| stop               | LCtrl + S                               |
+--------------------+-----------------------------------------+
| prev               | LCtrl + B                               |
+--------------------+-----------------------------------------+
| next               | LCtrl + F                               |
+--------------------+-----------------------------------------+
| rew                | LCtrl + LShift + B                      |
+--------------------+-----------------------------------------+
| fwd                | LCtrl + LShift + F                      |
+--------------------+-----------------------------------------+
| vol +              | Volume Up                               |
+--------------------+-----------------------------------------+
| vol -              | Volume Down                             |
+--------------------+-----------------------------------------+
| mute               | Volume Mute                             |
+--------------------+-----------------------------------------+
| ch +               | Page Up                                 |
+--------------------+-----------------------------------------+
| ch -               | Page Down                               |
+--------------------+-----------------------------------------+
| home               | LCtrl + LShift + LAlt + Home            |
+--------------------+-----------------------------------------+
| rec                | LCtrl + R                               |
+--------------------+-----------------------------------------+
| toggle             | Toggle between keyboard and mouse modes |
+--------------------+-----------------------------------------+
| 0...9              | 0...9                                   |
+--------------------+-----------------------------------------+
| shuffle            | LCtrl + LShift + LAlt + F               |
+--------------------+-----------------------------------------+
| repeat             | LCtrl + LShift + LAlt + B               |
+--------------------+-----------------------------------------+

Example 1 script
Image
Image
Image
Example 2 script
Image
I'm getting data for only 4 buttons and nothing for all others
What am I doing wrong? Any help appreciated


Last edited by Big Digger on August 18th, 2009, 9:56 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 10th, 2009, 11:29 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
Big Digger,
As you noticed yourself, the remote is seen as a keyboard, a mouse, and an "Other" HID device. It is completely possible for the remote to use the UsPg/Us 12/1 only for a few buttons and keyboard combinations for the other buttons. This happened in the remote I showed in the tutorial, where UsPg/Us 12/1 only covered some buttons. What you'll need to do is to intercept the input messages that the remote sends as keyboard presses. This means that you'll also face the problem ddh819 faced, with possible solutions here and here (with more details here).

Hope this helps!


Report this post
Top
 Profile  
Reply with quote  
 Post subject: thanks
PostPosted: August 12th, 2009, 10:09 pm 
Offline

Joined: August 26th, 2007, 10:22 pm
Posts: 8
thank you for this nice and clean solution! i will try to use it with my remote, as soon as my remote script is working i will post it here!


Report this post
Top
 Profile  
Reply with quote  
 Post subject: HELP
PostPosted: September 9th, 2009, 5:30 am 
Offline

Joined: November 26th, 2008, 4:13 pm
Posts: 12
This is my remote control:

Image

The remote control add in a HID device (remote control receiver) and a JoyStick to my PC. Like this:

Image

The script can get code from Joystick (Usage=5 and UsagePage=1).
But it can not get anything from the remote control receive (Usage=0 and UsagePage=65280).

can someone give me some advice?
thank you a lot.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 9th, 2009, 6:55 pm 
Offline

Joined: August 30th, 2009, 5:14 pm
Posts: 10
Thanks to TheGood et al. I got this working with my Logitech MX3200 kbd. I'll post my little script later.

I have a problem though:

Is there a way to "eat" a key. Certain keys will fire an action in Windows even though I am not using Logitech's software. These are the "common" extended keys like search computer or media keys like play and mute. Sometimes, this is ok but sometimes I want to completely override and define my own action.

any input appreciated, and thanks again for the great script.


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 ... 4, 5, 6, 7, 8, 9, 10 ... 27  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], iBob35555VR and 9 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