Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Questions and answers about 3Dconnexion devices on Windows.

Moderator: Moderators

Post Reply
Framed_Previz90
Posts: 19
Joined: Sat May 23, 2020 8:31 pm

Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Post by Framed_Previz90 »

I am trying to assign a hotkey, windows + F13, to one of the axis of the puck, according to the macro creator 68 corresponds to F13. I changed my global.xml accordingly, here is a snippet of the relevant part:

Code: Select all

...
 <Output>
	<ActionID>KB_Keystroke</ActionID>
	<Scale>5.00</Scale>
	<KeyStroke>
	  <Modifiers>
		<Modifier>Windows</Modifier>
	  </Modifiers>
		  <Key>68</Key>
	</KeyStroke>
 </Output>
...
The behaviour I am expecting is that when I push the puck towards an axis, the hotkeys windows + F13 to be repeatedly triggered, so that the repetition rate will be proportional to the pressure I apply.

I am not looking to have windows and F13 held down until I release the puck, its for this reason I omitted the node <RepeatStyle>PressAndHold</RepeatStyle>

But what I find is actually happening is that only F13 is being sent, looking at the OS system more closely, the windows key is never triggered at all, just F13.

I thing I am doing it wrong and I dont seem to be getting anywhere. I would appreciate any help in getting this right.
dougmurrray85
Posts: 35
Joined: Thu Feb 16, 2023 8:48 pm

Re: Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Post by dougmurrray85 »

I don't believe the windows modifier key is supported, only Control Alt and Shift, AND you can only enact one of those per axis... So sequences like Ctrl+Shift+scoll wheel are not possible :x

It's really frustrating how much control has been taken away from us power users :evil:
rottenconference
Posts: 1
Joined: Mon Apr 01, 2024 9:28 pm
Location: https://tunnel-rush.io

Re: Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Post by rottenconference »

dougmurrray85 wrote: Mon Apr 01, 2024 9:22 pm I don't believe the windows modifier key is supported, only Control Alt and Shift, AND you can only enact one of those per axis... So sequences like Ctrl+Shift+scoll wheel are not possible :x

It's really frustrating how much control has been taken away from us power users :evil:
That's true. Losing some control makes us upset.
dougmurrray85
Posts: 35
Joined: Thu Feb 16, 2023 8:48 pm

Re: Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Post by dougmurrray85 »

I also don't believe repeating keys are possible, only one shots.
jwick
Moderator
Moderator
Posts: 3342
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Post by jwick »

The Modifiers go outside the KeyStroke:

Code: Select all

<Output>
...
    <RepeatStyle>Auto</RepeatStyle>
    <Modifiers>
        <Modifier>Windows</Modifier>
    </Modifiers>
    <KeyStroke>
       <Key>68</Key>
    </KeyStroke>
</Output>
The Windows key is supported (and Control, Shift, Alt, LeftMouse, MiddleMouse, RightMouse).
RepeatStyle Auto sends the keys proportional to the magnitude of pressing the axis. PressAndHold is subject to the keyboard autorepeat implementation.
Scale controls the slope of the response.

You can do more, but you'd need to write code.
Framed_Previz90
Posts: 19
Joined: Sat May 23, 2020 8:31 pm

Re: Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Post by Framed_Previz90 »

jwick wrote: Mon Apr 01, 2024 11:40 pm The Modifiers go outside the KeyStroke:
Pardon me for the delayed follow up, work has been chaotic. I really appreciate the help I received
Aahh, so that's how it was to be done! Your conclusive answer was really what I needed, I was getting nowhere splicing pieces of xml nodes found here and there, and getting unexpected results.
>you can do more, but you'd need to write code.
I would really like to know more about this.

This is related to something I have wondered about quite a bit and through reading the forum, could not arrive at a meaningful conclusion to as well. I know the developers of a package have the 3dConnexion SDK available to them. But I wonder what resources are available to those whom don't have access to any source code, and yet still want to make use of a space mouse device in various ways.

For example in Autodesk Maya, the puck is "3d aware" but what if one wanted to momentarily turn that off, so as to use the puck to increase/decrease brush size or to scrub the timeline with variable speed, etc

I have been able to implement a simple optimal solution for none "3D aware" packages through xml file and AutoHotkey to control the puck just like any keyboard. But this gets complicated for "3D aware" packages like Maya, as I would like to only temporarily disable the "3D aware" features to use the device as a dummy keyboard device, then turn revert back to 3D navigation mode.

I tried to achieve this with AutoHotkey, by moving a global.xml file into the cfg directory as needed, so that while holding space, the puck sends keyboard/mouse keys and on being released, goes back to working as a "3D aware" device:

Code: Select all

Space::
FileCopy, F:\global.xml, C:\Users\ralf\AppData\Roaming\3Dconnexion\3DxWare\Cfg, 1
KeyWait, Space
FileDelete, C:\Users\ralf\AppData\Roaming\3Dconnexion\3DxWare\Cfg\global.xml
return
While it works reliably, there is about 1 to 2 seconds delay before the newly placed xml file is noticed by the device. I would like to ask you, if its possible to circumvent this delay and make the switch between the two modes quicker?

I am not opposed to the solution being another language, even a systems language such as C++, or a dll. I have come across such suggestions while reading the forum but have not seen examples or how to go about it, I also wonder if the solution lies in a single xml file, perhaps declaring all I need in a single xml file per package such as maya.xml and avoid moving xml files all together but my knowledge of the nodes needed are very limited and have not been able find sufficient samples on the forum.
jwick
Moderator
Moderator
Posts: 3342
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Post by jwick »

There are many ways to do this.
The easiest is probably to make use of the sophistication of autokey, rather than writing script/C++/etc code.

If it is in one app (maya?), I might suggest adding a different mode to the maya.xml cfg.
I'll need to work with you on this, at least to get started.
Using autokey for the details will probably provide better control for you. Their solution is much more capable than ours.

How does using a key on the 3D mouse to change modes sound? You can either hold it down temporarily (like the Shift key), or use it to toggle in and out of an "autokey mode" (like Caps Lock). The button just needs to go through our driver. It could even be on another device (Keyboard Pro, NumPad Pro, CadMouse, another 3D mouse).

In "autokey" mode, the device can send joystick events (axes and keys if you like), which I'd assume autokey handles very well.
Framed_Previz90
Posts: 19
Joined: Sat May 23, 2020 8:31 pm

Re: Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Post by Framed_Previz90 »

jwick wrote: Thu Apr 11, 2024 11:35 pm If it is in one app (maya?), I might suggest adding a different mode to the maya.xml cfg.
Well I have a few "3D aware" applications that I want the same set up for, but I am thinking if I have a working solution in Maya, then with some edits I can also get the same solution to work in another application, such as Zbrush.

If it helps, I essentially want the same keyboard keys bound to the pucks axis, regardless if the applications is "3d aware" or not. For clarity, I have created the following image, the red text are the keyboard keys I have in mind for each direction:
Image

I shared the above image for clarity, feel free to leave a place holder string for the <key> nodes value, if it makes things easier.
Using autokey for the details will probably provide better control for you. Their solution is much more capable than ours.
I would much prefer this too, as it does excel at binding functionality to a keyboard key and trigger them when said key is pressed.
How does using a key on the 3D mouse to change modes sound? You can either hold it down temporarily (like the Shift key), or use it to toggle in and out of an "autokey mode" (like Caps Lock). The button just needs to go through our driver. It could even be on another device (Keyboard Pro, NumPad Pro, CadMouse, another 3D mouse).
Could I possibly get both solutions? One that implement a "hold" to toggle mode and another that implements a "press" to toggle mode? I have different models at home, office and on the go. and I will undoubtedly will want to use different toggle methods.

If you need a specific device to target, I use the SpaceMouse Wireless mostly, as I can take it on the go, either of its left or right button will be fine as the "mode toggle" button.
It could even be on another device (Keyboard Pro, NumPad Pro, CadMouse, another 3D mouse)
I had no idea about this, good to know for sure.
jwick
Moderator
Moderator
Posts: 3342
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Post by jwick »

I guess we are talking about autohotkey here, for Windows. Autokey seems to be a Linux/Unix product.

Not knowing much about autohotkey, I'll need to rely on your experience. A quick search showed me that it can read joystick as well as keyboard input.

The problem with keyboard input is auto-repeat. It makes it quite unpredictable. If the driver holds down a key for too long, it will start auto-repeating at a different (system set) rate. I might try to evade that by releasing the key before it kicks in, still, not very predictable.

AFAIK, the joystick buttons don't autorepeat. There may be something to be said for using those controls (4 joystick buttons and 4 hat buttons). Though there are not enough for your requirements.

Or better yet, it appears autohotkey can read joystick values. This appears to give you much more control - 6 axes with analog values in each direction. E.g., you can switch at different values to different output. Our driver can do some of this, but there is no GUI for it, so it is very difficult to use.

If you are comfortable with using joystick autohotkey scripts, I'd suggest that.

This leaves the question of scope.

If you put these "alternate uses" into maya.xml they will be specific to Maya. You may also end up fighting with Maya when it changes modes.

If you put them into global.xml, they will be available everywhere, but you permanently lose buttons (on a device with very limited buttons) to switch modes. If one button does the "shift" operation and the other does the "caps lock" operation, you are out of buttons on a SpaceMouse wireless for anything else.
Perhaps I can do something with one button and a Radial Menu.
Framed_Previz90
Posts: 19
Joined: Sat May 23, 2020 8:31 pm

Re: Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Post by Framed_Previz90 »

jwick wrote: Mon Apr 15, 2024 12:06 am I guess we are talking about autohotkey here, for Windows. Autokey seems to be a Linux/Unix product.
Yes, I believe we are both talking about AutoHotkey

AutoHotkey does have good support for joysticks and I believe I can achieve what I need with them. So this is fine with me.
>If you put these "alternate uses" into maya.xml they will be specific to Maya. You may also end up fighting with Maya when it changes modes.
I see, I am in agreement then, this does not sound good.
>If you put them into global.xml, they will be available everywhere, but you permanently lose buttons (on a device with very limited buttons) to switch modes. If one button does the "shift" operation and the other does the "caps lock" operation, you are out of buttons on a SpaceMouse wireless for anything else.
This approach would be the most ideal for me. When I stated the following in my previous post:
>Could I possibly get both solutions? One that implement a "hold" to toggle mode and another that implements a "press" to toggle mode? I have different models at home, office and on the go. and I will undoubtedly will want to use different toggle methods.
What I meant is two separate, stand alone configurations intended for two computers. Because at home I use the SpaceMous pro wireless which I would prefer to use a "hold" (shift) operation to switch modes, and when I am on the go, I use the SpaceMouse Wireless, for which I would like a "press" (caps lock) operation to switch modes.
jwick
Moderator
Moderator
Posts: 3342
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Post by jwick »

Unfortunately using Global.xml does not seem to work well with the current release (we are skiing off the trail here).

You will need to make the cfg changes per application until I fix it.

To see the capabilities in the simplest form, save this into %appdata%\3Dconnexion\3DxWare\Cfg\jet.xml:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<AppCfg Default="false" xmlns="" CfgFormatVersion="1.3" ThisFileVersion="1.8">
	<CfgProperties>
		<ID>ID_STR_JET</ID>
		<Name>STR_JET</Name>
		<InheritsFromID>ID_STR_JET</InheritsFromID>
		<Access>
			<AllowInheritance>true</AllowInheritance>
			<Hidden>false</Hidden>
			<Ignore>false</Ignore>
		</Access>
	</CfgProperties>
	<AppInfo>
		<Signature>
			<Name>STR_JET</Name>
		</Signature>
		<Options/>
	</AppInfo>
	<AuthorInfo>
		<DriverVersion>17.8.20.20889</DriverVersion>
		<LastChange>
			<Tool>3DxService.exe</Tool>
			<Version>17.8.20.20889</Version>
			<Date>2024:4:3:17:8:57:45:403</Date>
			<User>ADB714F4-85D1-4915-8A36-C6796D456743</User>
		</LastChange>
		<Created>
			<Tool>3DxService.exe</Tool>
			<Version>17.8.21.20868</Version>
			<Date>2024:4:3:17:7:43:52:955</Date>
			<User>ADB714F4-85D1-4915-8A36-C6796D456743</User>
		</Created>
	</AuthorInfo>
	<ButtonActions>
		<!-- Axis/ApplicationBank operations -->
		<ButtonAction Type="AxisBank">
			<ID>AxisBank_ShiftToJoystick</ID>
			<Name>Shift to Joystick</Name>
			<Action>PushPop</Action>
			<BankID>JoystickBank</BankID>
			<ApplyTo>All</ApplyTo>
		</ButtonAction>
		<ButtonAction Type="ApplicationBank">
			<ID>ApplicationBank_ShiftLockToJoystick</ID>
			<Name>ShiftLock to Joystick</Name>
			<Action>Push</Action>
			<BankID>JoystickBank</BankID>
			<ApplyTo>All</ApplyTo>
		</ButtonAction>
		<ButtonAction Type="ApplicationBank">
			<ID>ApplicationBank_Pop</ID>
			<Name>Pop Back</Name>
			<Action>Pop</Action>
			<BankID>Default</BankID>
			<ApplyTo>All</ApplyTo>
		</ButtonAction>
	</ButtonActions>
	<Devices>
		<Device>
			<ID>ID_Standard_3D_Mouse</ID>
			<Name>Standard 3D Mouse</Name>
			<AxisFilter>None</AxisFilter>
			<CurrentAxisBank>Default</CurrentAxisBank>
			<AxisBank Default="true">
				<ID>JoystickBank</ID>
				<Name>JoystickBank</Name>
				<Axis>
					<Enabled>true</Enabled>
					<Input>
						<ActionID>HIDMultiAxis_X</ActionID>
						<Min>-512</Min>
						<Max>511</Max>
					</Input>
					<Output>
						<ActionID>HIDJoystick_X</ActionID>
					</Output>
				</Axis>
				<Axis>
					<Enabled>true</Enabled>
					<Input>
						<ActionID>HIDMultiAxis_Y</ActionID>
						<Min>-512</Min>
						<Max>511</Max>
					</Input>
					<Output>
						<ActionID>HIDJoystick_Y</ActionID>
					</Output>
				</Axis>
				<Axis>
					<Enabled>true</Enabled>
					<Input>
						<ActionID>HIDMultiAxis_Z</ActionID>
						<Min>-512</Min>
						<Max>511</Max>
					</Input>
					<Output>
						<ActionID>HIDJoystick_Z</ActionID>
					</Output>
				</Axis>
				<Axis>
					<Enabled>true</Enabled>
					<Input>
						<ActionID>HIDMultiAxis_Rx</ActionID>
						<Min>-512</Min>
						<Max>511</Max>
					</Input>
					<Output>
						<ActionID>HIDJoystick_Rx</ActionID>
					</Output>
				</Axis>
				<Axis>
					<Enabled>true</Enabled>
					<Input>
						<ActionID>HIDMultiAxis_Ry</ActionID>
						<Min>-512</Min>
						<Max>511</Max>
					</Input>
					<Output>
						<ActionID>HIDJoystick_Ry</ActionID>
					</Output>
				</Axis>
				<Axis>
					<Enabled>true</Enabled>
					<Input>
						<ActionID>HIDMultiAxis_Rz</ActionID>
						<Min>-512</Min>
						<Max>511</Max>
					</Input>
					<Output>
						<ActionID>HIDJoystick_Rz</ActionID>
					</Output>
				</Axis>
			</AxisBank>
			<ButtonBank Default="true">
				<ID>Default</ID>
				<Name>Default</Name>
				<InheritsFromID/>
				<Button>
					<Input>
						<ActionID>V3DK_MENU_1</ActionID>
					</Input>
					<Output>
						<ActionID>AxisBank_ShiftToJoystick</ActionID>
					</Output>
				</Button>
				<Button>
					<Input>
						<ActionID>V3DK_MENU_2</ActionID>
					</Input>
					<Output>
						<ActionID>ApplicationBank_ShiftLockToJoystick</ActionID>
					</Output>
				</Button>
			</ButtonBank>
			<ButtonBank>
				<ID>JoystickBank</ID>
				<Name>JoystickBank</Name>
				<InheritsFromID/>
				<Button>
					<Input>
						<ActionID>V3DK_MENU_1</ActionID>
					</Input>
					<Output>
						<ActionID>AxisBank_ShiftToJoystick</ActionID>
					</Output>
				</Button>
				<Button>
					<Input>
						<ActionID>V3DK_MENU_2</ActionID>
					</Input>
					<Output>
						<ActionID>ApplicationBank_Pop</ActionID>
					</Output>
				</Button>
			</ButtonBank>
		</Device>
	</Devices>
</AppCfg>

What this does:
Fundamentally, it defines an AxisBank that defines Joystick events, and switches to/from that.

The implementation of that:
There are three ButtonActions, which can be assigned to any button (that has a separate press and release state).
1) "Shift to Joystick" is the Shfit key functionality. When pressed, it switches the 3D mouse axes to send joystick events. When you release it, it goes back to what it was doing.
2) "ShiftLock to Joystick" is the ShiftLock/CapsLock functionality. Press it once and it switches the axes (AND the buttons).
3) "Pop Back" handles the second press of that button to switch back to the previous mode (3D mouse mode).

There is:
1) an AxisBank, which the buttons switch to. This defines the joystick axis events.
2) a "Default" ButtonBank that defines that the left and right buttons, call the aforementioned ButtonActions.
3) a "JoystickBank" ButtonBank that only exists to return back from Joystick mode (only necessary for ShiftLock mode).

I'm assuming you are using the latest 3DxWare release (10.8.20).
To test, run our jet.exe demo (in 3DxWinCore dir - normally C:\Program Files\3Dconnexion\3DxWare\3DxWinCore).
On a 2-button device (SpaceMouse Wireless/Compact/SpaceNavigator), I've assigned:
the left button to the "Shift" mode. It switches to Joystick mode while the button is pressed, and
the right button to the "ShiftLock" mode. It switches to Joystick mode when you press and release it. If it is pressed again, it switches back to the original mode.

To see what is going on, enable the driver's log file (right-click on the 3Dx systray icon ->Write Log File).
Download baretail and run it on %localappdata%\3Dconnexion\3DxWare\3DxService.log.
Run our jet demo.
When you switch to Joystick mode, using either method, the log file will show that joystick events are being sent out. The jet won't move.
You can reassign those buttons for other devices.
Since the driver is now sending joystick events, autohotkey should be able to translate them to whatever you want to do.

I don't have Maya here ATM to test it with. For Maya, you'll need to make the same changes to your %appdata%/.../Maya.xml file.

That is, add the 3 ButtonAction elements to the <ButtonActions> list.
Add the entire <Device>. If you already have some ID_Standard_3D_Mouse elements in there, you need to add the <AxisBank> and the two <ButtonBank>s.

There is a chance that you will end up fighting Maya on this. When you change modes in Maya, it may try to undo what you are doing. If you find this, let me know.

I never intended users to edit XML files. The GUI was supposed to do this for you...
If the XML editing is too much, PM your %appdata% files to me and I'll edit them and return them for you.

That's a lot to understand. I"m here to help.
Framed_Previz90
Posts: 19
Joined: Sat May 23, 2020 8:31 pm

Re: Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Post by Framed_Previz90 »

jwick wrote: Wed Apr 17, 2024 2:42 am I never intended users to edit XML files. The GUI was supposed to do this for you...
If the XML editing is too much, PM your %appdata% files to me and I'll edit them and return them for you.

That's a lot to understand. I"m here to help.
I appreciate the help jwick! I think I can manage further editing once I have it figured it out though!

As for the example you provided me, I finally got some time to myself to go through it.

Unfortunately, I was no able to get it working at all. I have updated my driver to the latest release and rebooted my system as required, I am currently on:

Code: Select all

3dxWare 10.8.20.3729
3dxWinCore 17.8.20.20889
But running the test using the Jet application, I can navigate in 3D mode fine but pressing/holding the buttons does not switch to joystick mode, instead 3D navigation continues to work.

After some time, I tried enabling logging and looking at it with Baretail but as soon as I enable logging via the tray icon, global.xml gets created besides jet.xml, I am not sure if this might be interfering with the logging, even then I looked at the log file, It mostly consisted of the following lines:

Code: Select all

00000004 22/4/2024 22:4:17.383: Device: \\?\HID#VID_256F&PID_C62F#9&83445F7&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}: EPS mean=62.509378, standardDeviation=0.009378
and when I press one of the buttons it would print:

Code: Select all

...
00000040 22/4/2024 22:2:48.454: InfoLineButtonPressedThread: woke up, quitting w/o modifying file
...
00000040 22/4/2024 22:2:49.000: InfoLineButtonPressedThread: woke up, quitting w/o modifying file
...
I have tried to privately message you the log files content as a messsage but the forum complaines about it being too long, I am not sure if I can message you files as attachments. I have encountered the same issue trying to upload it to an external site. I even tried to paste it into this post but its too long. I am not sure how to share it :/

Interestingly enough, looking at the GUI editor, it does seem to pick up the buttons you defined in the jet.xml* file:
Image
Framed_Previz90
Posts: 19
Joined: Sat May 23, 2020 8:31 pm

Re: Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Post by Framed_Previz90 »

jwick wrote: Wed Apr 17, 2024 2:42 am Unfortunately using Global.xml does not seem to work well with the current release (we are skiing off the trail here).

You will need to make the cfg changes per application until I fix it.
Aah, I forgot...If you would prefer for me to wait until you fix the issue you mention here, I would not mind checking back on you some time in the future. If so, please let me know and I will do that.
jwick
Moderator
Moderator
Posts: 3342
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Help with assigning a hotkey such as win+13 or ctrl+f13 to one of the axis please

Post by jwick »

I tried to send an email, but it bounced. Is the registered gmail address still valid?
Post Reply