Jump to content

CDU Control with one hand and any keyboard using AutoHotkey, NumLock and CapsLock


Recommended Posts

Posted (edited)

At first I thought I want to use second keyboard specified to CDU usage with Hid Macros, but found that software unnecessary and impossible to use. My keyboard names seem to change on every startup and that makes using Hid Macros impossible. There might be solution to that problem but I found that using AutoHotkey seems to be everything I need.

 

What I want: Write CDU with one hand using any keyboard available.

 

Solution: AutoHotkey and some keymapping in game options.

Result:

When NumLock is ON: numpad keys control camera like default controls are.

When Numlock is OFF: I can write CDU numbers with numpad keys. I have also mapped numpad delete as clear key so it is easier to clear what you write in CDU.

 

When Capslock and ScrolLock are both on: Alphabet keys write directly to CDU.

 

Playing with keyboard only. (Note that I have not mapped the plane steering keys into keyboard on the files included)

 

And the Latest code* in use on this video, now fully functional with my Saitek x52 Pro:

 

A-10CX52PRO12.jpg

 

There are some limitations on what kind of profile you can make on your Saitek profiler:

If you want to map alphabet keys on Saitek controller to any button, it has to be made in AutoHotkey file, and not in Saitek profile maker.**

Edit123: If you are planning to map lets say fire button D to press key R on keyboard.

 

This is an example about Fire button D pressing R:

;Fire button D to press R
Joy7::
GetKeyState, state, Joy7
if state = D
{
SendInput, {r Down}
KeyWait, Joy7
SendInput, {r Up}
}
return

After this you have to compile a new exe using Autohotkey. Basicly just right mouse click the file and choose compile. I never got the loop working on my computer so I made all keys as seperate scripts.

 

 

 

*After making that video I have added:

Update 1:

Added Wheelbrake to Pinky button.

Added Airbrake to Precision Slider (note that it presses + and -)

Added Flaps Up and Down to left toggle on joystick base.

Update 1.1:

Added Gear Up and Down to middle toggle on joystick base.

Update 1.2:

Added A&G button to stick right toggle down.

Added wheel turn toggle to throttle (i) button.

Changed TS Com into more usable config. (Ctrl + PgUp)

 

**Edit 2014:

-If you want to map controller keys completely inside DCS world or if you are not using Saitek x52 pro:

Use DCS_A-10_No_Saitek that is included and map controller keys inside DCS world like you would normally do.

Note: Keep in mind that every update seems to set controls to default.

-Remember to shutdown the autohokey script when playing anything else. There is currently a problem that you have to release keys before pressing another or the last one stays "down". Try some fps game to understand what i mean... TODO: needs to be fixed when time!

 

New Files are attached:

A-10_2014.zip

Edited by RpSPT
Update 2014
  • Like 1
Posted (edited)
Good solution!

 

I used my numpad as CDU as well combined with trackir

but for those without trackir this is perfect!

 

I also have trackir but noticed I still sometimes need the view keys. The real reason for this though is to get all the keys to work "second" time to write coordinates with one hand. For example with normal keymaps to write on CDU you have to press and hold LCtrl + Lwin and then type and that takes two hands. With AutoHotkey you can also get the alphabet keys second time into what ever use you need them to.

Edited by RpSPT
Posted (edited)

; Alphabet to work as CDU buttons when Capslock and Scrolllock is ON

#UseHook
keys := "abcdefghijklmnopqrstuvwxyz"
Loop parse, keys
Hotkey %A_LoopField%, PressKey
return

PressKey:
state := GetKeyState("CapsLock", "T") and GetKeyState("Scrolllock", "T")
if not state {
Send, % "{" A_ThisHotkey " down}"
KeyWait, %A_ThisHotkey%
Send, % "{" A_ThisHotkey " up}"
}
else {
Send, {LControl Down}
Sleep, 1
Send, {LWin Down}
Sleep, 1
Send, % "{" A_ThisHotkey " down}"
Sleep, 1
KeyWait, %A_ThisHotkey%
Send, % "{" A_ThisHotkey " up}"
Sleep, 1
Send, {LWin Up}
Sleep, 1
Send, {LControl Up}
}
return

This should work, and is working with atleast one computer, but on my computer this script doesnt do anything. Be careful if testing this in Windows. LCtr + LWin + anykey does all kind of things like select all...

 

What it is supposed to do: When both ScrLk and CapsLock are on all alphabet keypresses are supposed to work as LCtr + LWin + "the key itself". That would allow writing to CDU easily while flying A-10

Edited by RpSPT
Saitek and its problems...
Posted (edited)

I have now made files available.

 

These files are only for Saitek x52 Pro currently. I also have the .afk file included that can be modified if you want to use this with another controller. Ask if you need help.

 

There are some limitations on what kind of profile you can make on your Saitek profiler:

If you want to map alphabet keys on Saitek controller to any button, it has to be made in AutoHotkey file, and not in Saitek profile maker.

Edit 2014: You can also map joystick controls in game normally and use No_saitek script. No need for changing your input files if you map controls in game.

 

I also have a question about slew smoothnes:

Is it possible to make the slew any smoother than this? I am currently using the POV 1 on stick. I wish the mouse stick could work as a POV. That would make everything so much easier.

Edited by RpSPT
Posted (edited)

Now that I have actually played with this profile I noticed that I was missing some buttons that are quite handy on landings.

 

After making the Profile Demonstration video I have added:

Update 1:

Added Wheelbrake to Pinky button.

Added Airbrake to Precision Slider (note that it presses + and -)

Added Flaps Up and Down to left toggle on joystick base.

Update 1.1:

Added Gear Up and Down to middle toggle on joystick base.

 

Edit: Updated profile picture to first post.

Edit: Update 1.2:

Added A&G button to stick right toggle down.

Added wheel turn toggle to throttle (i) button.

Changed TS Com into more usable config. (Ctrl + PgUp)

Edited by RpSPT
Posted

Will this work within DCS World?

PC: Asus P8Z77-M Mainboard; Intel i5-3570K (4x3,4Ghz) mit Scythe Mugen 3 CPU Kühler; 16Gb Corsair XMS3 1600Mhz; Nvidia GTX570 1280mb; Samsung 830 SSD; Samsung HDD

Flight Sim Gear: TM Warthog; Saitek Pro Pedals; TM Cougars on an 19" screen; TrackIR 5 w/ trackclip pro; Logitech G35 headset

Posted (edited)
Will this work within DCS World?

 

It works in what ever program you wish to use it. The files are basicly a Saitek Profile that uses both AutoHotkey and Saitek STT. (Be Warned the capslk scrlk thing also currently works in Windows Desktop)

 

It works in a way that it maps joystick buttons to use keyboard keys and scripts like LCtrl + B. When the A-10 exe included is running and CapsLock and ScrLk are on it also maps abcd...xyz keys as LCtrl + LWin + The key you press. So if you want to use this profile in some other game you just have to map the buttons the same way as in DCS World. Basicly you dont have to worry about what keyboard key is mapped into what button you can just press the joystick button in that games option to map the buttons.

[Edit 2014: You can also use the included No_Saitek script and map your controls in game for whatever joystick you are using.]

 

By the way I made for my self a batch file that starts all the programs from one shortcut: DCS World, AutoHotkey file and TrackIR. You could also include Helios if you are running multible monitors or what ever program you need.

 

I higly recommend making a batch file.

 

Edit: One more thing, if you also fly the Ka-50 you probably should shutdown the AutoHotkey file and change the Saitek profile as currently I dont have the Ka-50 input files included. Ofcourse you can map the buttons and keys for Ka-50 using the same profile.

Edited by RpSPT
  • Like 1
Posted

Thank you for you quick reply. I just use A10 and FC3. So Later this evening I will have time to test it!

PC: Asus P8Z77-M Mainboard; Intel i5-3570K (4x3,4Ghz) mit Scythe Mugen 3 CPU Kühler; 16Gb Corsair XMS3 1600Mhz; Nvidia GTX570 1280mb; Samsung 830 SSD; Samsung HDD

Flight Sim Gear: TM Warthog; Saitek Pro Pedals; TM Cougars on an 19" screen; TrackIR 5 w/ trackclip pro; Logitech G35 headset

  • 1 year later...
Posted (edited)

A little tip. Saitek Profiles have to be placed in (Users\Public\Documents\SmartTechnology Profiles) to show up on Saitek Software.

 

Edit:

I edited the first post and changed the files to new ones.

Edited by RpSPT
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...