Newcomer / Intro Extracting a text list of key bindings from the .binds file?

I've gotten far enough along in playing that I understand the concept of the .binds file and know where to find it and how to take a look at it. I'm just wondering if someone has created a utility that will extract the actual key bindings from the file and output it into a simple text file. I'm way past the age where I could come up with this on my own, but I figure one of you bright young people may have already done it :)
 
I've gotten far enough along in playing that I understand the concept of the .binds file and know where to find it and how to take a look at it. I'm just wondering if someone has created a utility that will extract the actual key bindings from the file and output it into a simple text file. I'm way past the age where I could come up with this on my own, but I figure one of you bright young people may have already done it :)

bit confused here as if you can open the file (notepad) all the info is there, just copy and paste to a new text file and you're done.
 
right click it and select 'open', if notepad isn't offered select 'more options' and notepad will be on that list.

(this method has been tested and confirmed with windows 8.1)

alternatively you can install notepad++ for the option to 'edit with' to be on the right click menu.

http://notepad-plus-plus.org/

I can confirm... that this method is not working with Win 7 :)

more software.... ?.... no thanks

I'll try it with one of my Linux installs later.... at the moment it's 4 am and the Champers is making my eyes cross... Happy New Year !!!!
 
that's a surprise, you should still the option to 'open with' on the right click menu, from there is just a matter of selecting the program to do it.
 
I guess I wasn't being clear. I can open the .binds file in Notepad++ just fine, however, what I'm looking for is a utility that turns this:

<LeftThrustButton>
<Primary Device="LogitechExtreme3DPro" Key="Joy_POV1Left" />
<Secondary Device="{NoDevice}" Key="" />
</LeftThrustButton>
<RightThrustButton>
<Primary Device="LogitechExtreme3DPro" Key="Joy_POV1Right" />
<Secondary Device="{NoDevice}" Key="" />
</RightThrustButton>
</VerticalThrust>

Into this:

LeftThrustButton: Primary Device= LogitechExtreme3DPro Key=Joy_POV1Left, Secondary Device=NoDevice Key=
RightThrustButton: Primary Device= LogitechExtreme3DPro Key=Joy_POV1Right, Secondary Device=NoDevice Key=

In other words, it strips out and replaces certain text characters and symbols so what you get is a cleaner, easier to read text file. In MS Word you can build macros that do this, but it's very unwieldy. I was just wondering if someone with some mad coding skills had thought of it and built a utility.
 
  • Like (+1)
Reactions: TDF

I've made changes to the bindings in-game and sometimes I can't remember what function is bound to what key. While I can open the whole xxx.binds file in Notepad++, it still takes some poking around in there to find something; I can always open the controls screen in-game, but I have to scroll down a bit. I figure someone might have made a converter that generated plain text with a bit of formatting, so the .binds file can be converted to something that prints out cleanly. I'm very big on having printed out play aids next to me; maybe I'm the only one:S
 
I've made changes to the bindings in-game and sometimes I can't remember what function is bound to what key. While I can open the whole xxx.binds file in Notepad++, it still takes some poking around in there to find something; I can always open the controls screen in-game, but I have to scroll down a bit. I figure someone might have made a converter that generated plain text with a bit of formatting, so the .binds file can be converted to something that prints out cleanly. I'm very big on having printed out play aids next to me; maybe I'm the only one:S

Got it :)
Just load a file on XMLGrid.net (or paste) Chose/Submit anbd Load, click on Options, select Plain text/OK, select Root and Convert.
Then you have a plain text.
 
Unfortunately it doesn't work as I hoped. For example, in the .binds file it shows:

<CycleFireGroupNext>
<Primary Device="Keyboard" Key="Key_Period" />
<Secondary Device="{NoDevice}" Key="" />
</CycleFireGroupNext>
<CycleFireGroupPrevious>
<Primary Device="Keyboard" Key="Key_Comma" />
<Secondary Device="{NoDevice}" Key="" />
</CycleFireGroupPrevious>
<DeployHardpointToggle>
<Primary Device="Keyboard" Key="Key_Enter" />
<Secondary Device="LogitechExtreme3DPro" Key="Joy_8" />
</DeployHardpointToggle>

Which converts to:

Keyboard Key_Period {NoDevice}
Keyboard Key_Comma {NoDevice}
Keyboard Key_Enter LogitechExtreme3DPro Joy_8 0

Oh well, I'll keep poking around for a solution.
 
What's so difficult in opening it with the Notepad, the standard one, which is built in Windows? Or Wordpad?
 
What's so difficult in opening it with the Notepad, the standard one, which is built in Windows? Or Wordpad?

Did you mean opening it in Notepad versus opening it in Notepad++? Notepad++ is just easier to work with for XML because it does some loop indenting. It's a personal preference.

If you are referring to the reason why I'm looking for something that converts the .binds file to a cleaner text file, this is what I posted about that above:

I guess I wasn't being clear. I can open the .binds file in Notepad++ just fine, however, what I'm looking for is a utility that turns this:

<LeftThrustButton>
<Primary Device="LogitechExtreme3DPro" Key="Joy_POV1Left" />
<Secondary Device="{NoDevice}" Key="" />
</LeftThrustButton>
<RightThrustButton>
<Primary Device="LogitechExtreme3DPro" Key="Joy_POV1Right" />
<Secondary Device="{NoDevice}" Key="" />
</RightThrustButton>
</VerticalThrust>

Into this:

LeftThrustButton: Primary Device= LogitechExtreme3DPro Key=Joy_POV1Left, Secondary Device=NoDevice Key=
RightThrustButton: Primary Device= LogitechExtreme3DPro Key=Joy_POV1Right, Secondary Device=NoDevice Key=

In other words, it strips out and replaces certain text characters and symbols so what you get is a cleaner, easier to read text file. In MS Word you can build macros that do this, but it's very unwieldy. I was just wondering if someone with some mad coding skills had thought of it and built a utility.
 
I actually considered writing a little utility to parse the XML and display in an easily printable format, but found it quicker just to make a copy of the file, manually strip out what I didn't want and reformatting what I did want... It's not really all that hard... It's not some foregin language, it's all plain text.
 
Here's a quick and dirty little PowerShell script. Just change the $InputFilename variable to the file you want to parse. It will create a new file with ".txt" extension. Copy the code, change the InputFilename, save it with a .ps1 extension and run it with PowerShell. You might need to run PowerShell as Administrator and give the command "Set-ExecutionPolicy Unrestricted" to get unsigned scripts to run.
.
Code:
Code:
$InputFilename = "c:\temp\Custom.binds"
$OutputFilename = "$InputFilename.txt"
[xml]$binds = Get-Content $InputFilename
foreach ($node in $binds.Root.ChildNodes) {
	$NodeText = $node.InnerXml -split "/>"
	$ItemText = ""	
	foreach ($item in $NodeText) {
		$item = $item -replace "<",$null
		$ItemText += "  $item`n"
	}
	$text = $node.Name + ":`n" + $ItemText
	$output += $text
}
$output | Out-File $OutputFilename
.
Sample Output:
Code:
YawAxis:
  Binding Device="CHProPedals" Key="Joy_ZAxis" 
  Inverted Value="0" 
  Deadzone Value="0.00000000" 
  
YawLeftButton:
  Primary Device="Keyboard" Key="Key_A" 
  Secondary Device="{NoDevice}" Key="" 
  
YawRightButton:
  Primary Device="Keyboard" Key="Key_D" 
  Secondary Device="{NoDevice}" Key="" 
  
YawToRollMode:
  
YawToRollSensitivity:
  
YawToRollButton:
  Primary Device="{NoDevice}" Key="" 
  Secondary Device="{NoDevice}" Key="" 
  ToggleOn Value="0" 
  
RollAxis:
  Binding Device="068EC0F3" Key="Joy_XAxis" 
  Inverted Value="0" 
  Deadzone Value="0.00000000" 
  
RollLeftButton:
  Primary Device="{NoDevice}" Key="" 
  Secondary Device="{NoDevice}" Key="" 
  
RollRightButton:
  Primary Device="{NoDevice}" Key="" 
  Secondary Device="{NoDevice}" Key="" 
  
PitchAxis:
  Binding Device="068EC0F3" Key="Joy_YAxis" 
  Inverted Value="1" 
  Deadzone Value="0.00000000" 
  
PitchUpButton:
  Primary Device="{NoDevice}" Key="" 
  Secondary Device="{NoDevice}" Key="" 
  
PitchDownButton:
  Primary Device="{NoDevice}" Key="" 
  Secondary Device="{NoDevice}" Key="" 
  
LateralThrust:
  Binding Device="CHProThrottle2" Key="Joy_XAxis" 
  Inverted Value="0" 
  Deadzone Value="0.11104845" 
  
LeftThrustButton:
  Primary Device="Keyboard" Key="Key_Q" 
  Secondary Device="{NoDevice}" Key="" 
  
RightThrustButton:
  Primary Device="Keyboard" Key="Key_E" 
  Secondary Device="{NoDevice}" Key="" 
  
VerticalThrust:
  Binding Device="CHProThrottle2" Key="Joy_YAxis" 
  Inverted Value="1" 
  Deadzone Value="0.11104845" 
  
UpThrustButton:
  Primary Device="Keyboard" Key="Key_R" 
  Secondary Device="{NoDevice}" Key="" 
  
DownThrustButton:
  Primary Device="Keyboard" Key="Key_F" 
  Secondary Device="{NoDevice}" Key=""
 
Last edited:
Here's a quick and dirty little PowerShell script

Thanks, that actually works pretty nicely. I trimmed out the large sections where I had no keys assigned and that leaves me with a more manageable file. Now, if you really have some mad skillz ;) would it be possible to have the code delete any line that contains "{NoDevice}"? That would remove unneeded lines that show what's not assigned to a key or button/axis while still leading the function name itself, like below:

This code generated by your current script:
CycleNextTarget:
Primary Device="LogitechExtreme3DPro" Key="Joy_6"
Secondary Device="{NoDevice}" Key=""

CyclePreviousTarget:
Primary Device="{NoDevice}" Key=""
Secondary Device="{NoDevice}" Key=""

SelectHighestThreat:
Primary Device="{NoDevice}" Key=""
Secondary Device="{NoDevice}" Key=""

CycleNextHostileTarget:
Primary Device="{NoDevice}" Key=""
Secondary Device="{NoDevice}" Key=""

CyclePreviousHostileTarget:
Primary Device="{NoDevice}" Key=""
Secondary Device="{NoDevice}" Key=""

CycleNextSubsystem:
Primary Device="LogitechExtreme3DPro" Key="Joy_5"
Secondary Device="{NoDevice}" Key=""

CyclePreviousSubsystem:
Primary Device="{NoDevice}" Key=""
Secondary Device="{NoDevice}" Key=""

becomes this:
CycleNextTarget:
Primary Device="LogitechExtreme3DPro" Key="Joy_6"

CyclePreviousTarget:

SelectHighestThreat:

CycleNextHostileTarget:

CyclePreviousHostileTarget:

CycleNextSubsystem:
Primary Device="LogitechExtreme3DPro" Key="Joy_5"

CyclePreviousSubsystem:


However, just what you've posted has been a real help and I appreciate the work, thanks! :D
 
would it be possible to have the code delete any line that contains "{NoDevice}"? That would remove unneeded lines that show what's not assigned to a key or button/axis while still leading the function name itself

Try this:
Code:
$InputFilename = "c:\temp\Custom.binds"
$OutputFilename = "$InputFilename.txt"
[xml]$binds = Get-Content $InputFilename
foreach ($node in $binds.Root.ChildNodes) {
	$NodeText = $node.InnerXml -split "/>"
	$ItemText = ""	
	foreach ($item in $NodeText) {
		$item = $item -replace "<",$null
		if (!($item -match "{NoDevice}")) {
			$ItemText += "  $item`n"
		}
	}
	$text = $node.Name + ":`n" + $ItemText
	$output += $text
}
$output | Out-File $OutputFilename
.
Result:
Code:
ThrottleAxis:
  Binding Device="CHProThrottle2" Key="Joy_ZAxis" 
  Inverted Value="1" 
  Deadzone Value="0.00000000" 
  
ThrottleRange:
  
ToggleReverseThrottleInput:
  Secondary Device="CHProThrottle2" Key="Joy_3" 
  ToggleOn Value="0" 
  
ForwardKey:
  Primary Device="Keyboard" Key="Key_W" 
  
BackwardKey:
  Primary Device="Keyboard" Key="Key_S" 
  
ThrottleIncrement:
  
SetSpeedMinus100:
  
SetSpeedMinus75:
  
SetSpeedMinus50:
  
SetSpeedMinus25:
  
SetSpeedZero:
  Primary Device="Keyboard" Key="Key_X"
 
Last edited:
Back
Top Bottom