Sign in to follow this  
Followers 0
sshrum

3d mouse...curious if autoit can get values from it.

7 posts in this topic

#1 ·  Posted (edited)

I don't do 3D nav'ing but figured for $7 at a swap meet, I could use this $100 device as a media player control knob that will migrate into a future car-pc build.

Manufacturer product page: http://www.3dconnexion.com/products/spacenavigator.html

The manufacturer website indicates that it supports RawInput, Raw Input, WM_INPUT but I've never worked with these.

I downloaded a user-level driver (UMDF) that maps the 3DConnexion to a Windows 7 Sensor from this website: http://www.turboirc.com/3dcs/

My main goal is to just get values from the device to trigger user assignable applications whereas twisting left (-rz) would call my voldown.exe, pushing to the right (+x) would call my next.exe, pressing down (-z) would run my playpause.exe, etc.

I'd like to monitor for certain thresholds as to not accidentally trigger events such as a down action (.1) when the twist action (-3) was occurring.

I will then be able to write a GUI that can be tailored to call other user-definable commands based on what application was current (pulling up while in Internet Explorer could call zoom in, etc)

I can write all the code for assigning and gui and so forth, I just have no grasp on getting the input from the device.

Just curious if anyone has any advice on working with this.

BTW: Yes I thought about just running the 3dcs app and leeching the values off that window but figured I'd like to dive more into input coding.

TIA

Edited by sshrum

Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Share this post


Link to post
Share on other sites



Unfortunately you have several problems. Firstly, no one else on the forum is going to have that mouse unless you are really lucky, so anything we say is speculation at best. Secondly, all the examples you do find are going to be written using C and using the low level windows api, little of that has been implemented in AutoIt. So you have a big job ahead of you. However, if you do it, then that demonstration on the 3Dconnexion website was amazing, and I would love to have that sort of mouse (I got a new mouse for christmas, which is very nice, but not quite that nice).

Anyway, as said, we can't help you that much, but here is what msdn has for you: examples

Share this post


Link to post
Share on other sites

While I waiting for responses, I wrote a little autoit script that leeches the values off the 3dcs screen. This works pretty good for my first pass at this.

I defined a tolerance value (=2) and when any of the axis values meet it (+/-), it calls my _Event($sAxis, $sValue) function ($sValue I just evaluate as either '-' or '+'). If no ini entry exist for the [Process]Axis/Value, I prompt for a filename and save it to a ini in the @scriptdir:

[SciTE.exe]
X+=M:\_player\exe\Control ^\Next.exe
RZ+=M:\_player\exe\Volume+- ^\+10%.exe
RZ-=M:\_player\exe\Volume+- ^\-10%.exe
Z+=M:\_player\exe\Control ^\Play Pause.exe
X-=M:\_player\exe\Control ^\Previous.exe
Z-=M:\_player\exe\Position ^\Restart song.exe
RY-=M:\_player\exe\Control ^\Step Forward.exe
RY+=M:\_player\exe\Control ^\Step Back.exe
B1=M:\_player\exe\Options ^\Shuffle Toggle.exe
B2=M:\_player\exe\Options ^\Debug Toggle.exe

[chrome.exe]
Y+=S:\send-pagedown.au3
Y-=S:\send-pageup.au3

Just wished I could access the values directly instead of having to depend on leeching the text off the 3dcs window.


Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Share this post


Link to post
Share on other sites

Just a quick update: OMG...this is freakin awesome. I didn't think this was going to work as great as it is. Having the second mouse I figured would be a pain as I'm so used to using the keyboard to deal with shortcuts. I just cranked out a couple simple 1-liner send() .au3 files and left them uncompiled (I use the Run action in Shellexecute). As I switch from the various apps I use, the script is adapting and letting me customize actions. I'll post more later as I think this may bite me in the ass if I start getting too many settings across multiple programs, I'll tend to confuse them.

Maybe a traytip when the active process is changed? Hehe.


Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Share this post


Link to post
Share on other sites

I have a SpaceNavigator too, mainly for CAD work. Hard to live without it. Great for Google Earth, too. It's not a mouse, though... you use it with your mouse.

You might want to look here. I've used the RCB9 driver and it works quite well; IIRC it's more customizable than the stock driver

Share this post


Link to post
Share on other sites

@Dana: True..it's not a mouse. More of a alternate input device.

Didn't get to bed til 4 am...playing with this setup is freakin' awesome (plus making a ton of 1-liner send() AU3 files to send keyboard shortcuts with it). Sitting in bed I thought of a ton of stuff to make my little script better (enabling velocity to control how fast reruns occur, general settings to allow for singular app definitions, active application-sensing GUI definition screens, etc). Oh, I'm getting goosebumps.

Thanx for the link, I'll check it out.


Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I've finished with the v.1 build. I've posted the project and the support files here. I also included all the send files and the quickie script I wrote to build all 2,146 of them (37 kb; located in the send folder)

The initial setup is a little quirky as the 3dcs app needs to be setup to point to your 3d mouse HID and that is via the old 'trial and error' approach over 10 items. However, once you get the right HID, you'll see the values in the 3dcs change as you move the knob. 3dcs luckily stores the setting between runs. The other thing is once you run my 3dcmapr app, it will automatically launch the 3dcs app which cannot be hidden (I tried :x @SW_HIDE) so it will pop up in the middle of your screen when it is run...feel free to shove it off-screen. 3dcmapr will automatically close 3dcs when it exits.

Systray icons for dedicated mode: name 2 icon files as 'on.ico' and 'off.ico'. 3dcmapr will use 'on.ico' when dedicated mode is active, 'off.ico' when not.

If you have any suggestions feel free to post them here or use the systray menu 'Help" menu option.

EDIT: Forgot to mention I hard-coded the right side button to switch between dedicated / non-dedicated modes.

Dedicated mode is for sending events to your most used app regardless of what program has focus...say like a media player or something like that, you can pick. Non-dedicated mode will look at what is the currently focused window and allow you to build a profile for that app.

Edited by sshrum

Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

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