Preflight.bat - How to launch all the programs you need for you flight sim

Ok. So @hreich asked for my batch file in this thread:

I’m not a programmer and it might be a little inconsistent at some places but at least it’s working. I will also write something on my train on thoughts and my setup below.

But first, here is the bat in all it’s glory:

Click to enter the bat cave
@echo off
COLOR 0E

set A10C_ID=1
set F15_ID=2
set A10A_ID=3
set MiG29A_ID=4
set MiG29S_ID=5
set Su33_ID=6
set Su27_ID=7
set Su25_ID=8
set MiG21bis_ID=b
set UH1_ID=h
set M2000C_ID=m
set P51D_ID=p
set MiG15_ID=q
set F5_ID=t
set AJS37_ID=a
set F86_ID=w

echo Preflight Preperation initiated....
echo.
echo Which simulation will be launched?
echo ==================================
echo g) Generic X-Padder [PTT and TIR]
echo v) vJoy (combined axis) [UJR for AHK, PTT and TIR]
echo.
echo %A10C_ID%) DCS: A-10C Warthog		%P51D_ID%) DCS: P-51D Mustang
echo %F15_ID%) DCS: F-15 Eagle		%A10A_ID%) DCS: A-10A
echo %MiG29A_ID%) DCS: MiG-29A Fulcrum		%MiG29S_ID%) DCS: MiG-29S Fulcrum
echo %Su33_ID%) DCS: Su-33 Flanker		%Su27_ID%) DCS: Su-27 Flanker
echo %Su25_ID%) DCS: Su-25 Frogfoot		%F5_ID%) DCS: F-5E Tiger II		
echo %MiG21bis_ID%) DCS: MiG-21bis Fishbed	%AJS37_ID%) DCS: AJS-37 Viggen
echo %M2000C_ID%) DCS: M-2000C
echo %MiG15_ID%) DCS: MiG-15 Fagot		%F86_ID%) DCS: F-86 Sabre
echo %UH1_ID%) DCS: UH-1 Huey

echo.
echo c) Cliffs of Dover
echo e) Elite Dangerous
echo f) Falcon BMS
echo.
echo a) Assetto Corsa
echo.
echo 0) [No X-Padder]
echo.
set /p usim="Make your choice: "

COLOR 0A
set Stick="#empty"
set Throttle="#empty"
set Bodnar="#empty"
set Quadrant="#empty"
set MFD1="#empty"
set MFD2="#empty"

echo Preparing game specific scripts...
IF  "%usim%"=="g" (
	REM Generic X-Padder
	set Stick="#TIR-Stick"
	set Throttle="#PTT-Throttle"
	set Bodnar="#empty"
	set Quadrant="#empty"
) ELSE IF  "%usim%"=="v" ( 
	REM vJoy with UJR
	set Stick="#TIR-Stick"
	set Throttle="#PTT-Throttle"
	set Quadrant="#empty"
	echo.
	echo Launching Virtual Joystick Mapper...
	start "UJR" "C:\Tools\ujr autohotkey for vjoy\ujr.exe"
	echo ...Done!
	echo.

REM DCS Aircraft	
	
) ELSE IF  "%usim%"=="%AJS37_ID%" (
	REM DCS:AJS-37 Viggen
	set Stick="DCS-Viggen-Stick"
	set Throttle="DCS-Viggen-Throttle"
	set Bodnar="DCS-Viggen-Bodnar"
	set Quadrant="#empty"
	set MFD1="#empty"
	set MFD2="#empty"
) ELSE IF  "%usim%"=="%F5_ID%" (
	REM DCS:F-5 Tiger II
	set Stick="DCS-F-5E-Stick"
	set Throttle="DCS-F-5E-Throttle"
	set Bodnar="DCS-F-5E-Bodnar"
	set Quadrant="DCS-F-5E-Quadrant"
	set MFD1="DCS-F-5E-MFD1"
	set MFD2="#empty"
) ELSE IF  "%usim%"=="%MiG15_ID%" (
	REM DCS:MiG-15
	set Stick="DCS-MiG-15-Stick"
	set Throttle="DCS-MiG-15-Throttle"
	set Bodnar="DCS-MiG-15-Bodnar"
	set Quadrant="#empty"
	set MFD1="#empty"
	set MFD2="#empty"
) ELSE IF  "%usim%"=="%MiG21bis_ID%" (
	REM DCS:MiG-21bis
	set Stick="#TIR-Stick"
	set Throttle="#PTT-Throttle"
	set Bodnar="DCS-MiG-21-Bodnar"
	set Quadrant="DCS-MiG-21-Quadrant"
	set MFD1="#empty"
	set MFD2="#empty"
) ELSE IF  "%usim%"=="%A10C_ID%" (
	REM DCS:A-10C
	set Stick="DCS-A-10C-Stick"
	set Throttle="DCS-A-10C-Throttle"
	set Bodnar="DCS-A-10C-Bodnar"
	set Quadrant="DCS-A-10C-Quadrant"
	set MFD1="#empty"
	set MFD2="#empty"
) ELSE IF  "%usim%"=="%F86_ID%" (
	REM DCS:F-86
	set Stick="DCS-F-86-Stick"
	set Throttle="DCS-F-86-Throttle"
	set Bodnar="DCS-F-86-Bodnar"
	set Quadrant="#empty"
	set MFD1="#empty"
	set MFD2="#empty"
) ELSE IF  "%usim%"=="%F15_ID%" (
	REM DCS:F-15
	set Stick="DCS-F-15-Stick"
	set Throttle="DCS-F-15-Throttle"
	set Bodnar="DCS-F-15-Bodnar"
	set Quadrant="#empty"
	set MFD1="#empty"
	set MFD2="#empty"
) ELSE IF  "%usim%"=="%Su25_ID%" (
	REM DCS:Su-25
	set Stick="DCS-Su-25-Stick"
	set Throttle="DCS-Su-25-Throttle"
	set Bodnar="DCS-Su-25-Bodnar"
	set Quadrant="#empty"
	set MFD1="#empty"
	set MFD2="#empty"
) ELSE IF  "%usim%"=="%A10A_ID%" (
	REM DCS:A-10A
	set Stick="DCS-A-10A-Stick"
	set Throttle="DCS-A-10A-Throttle"
	set Bodnar="DCS-A-10A-Bodnar"
	set Quadrant="DCS-A-10A-Quadrant"
	set MFD1="#empty"
	set MFD2="#empty"
) ELSE IF  "%usim%"=="%MiG29A_ID%" (
	REM DCS:MiG-29A
	set Stick="DCS-MiG-29-Stick"
	set Throttle="DCS-F-15-Throttle"
	set Bodnar="DCS-F-15-Bodnar"
	set Quadrant="DCS-F-15-Quadrant"
	set MFD1="#empty"
	set MFD2="#empty"
) ELSE IF  "%usim%"=="%MiG29S_ID%" (
	REM DCS:MiG-29S
	set Stick="DCS-MiG-29-Stick"
	set Throttle="DCS-F-15-Throttle"
	set Bodnar="DCS-F-15-Bodnar"
	set Quadrant="DCS-F-15-Quadrant"
	set MFD1="#empty"
	set MFD2="#empty"
) ELSE IF  "%usim%"=="%Su27_ID%" (
	REM DCS:Su-27
	set Stick="DCS-F-15-Stick"
	set Throttle="DCS-F-15-Throttle"
	set Bodnar="DCS-F-15-Bodnar"
	set Quadrant="DCS-F-15-Quadrant"
	set MFD1="#empty"
	set MFD2="#empty"
) ELSE IF  "%usim%"=="%Su33_ID%" (
	REM DCS:Su-33
	set Stick="DCS-F-15-Stick"
	set Throttle="DCS-F-15-Throttle"
	set Bodnar="DCS-F-15-Bodnar"
	set Quadrant="DCS-F-15-Quadrant"
	set MFD1="#empty"
	set MFD2="#empty"
) ELSE IF  "%usim%"=="%UH1_ID%" (
	REM DCS:UH-1 Huey
	set Stick="DCS-UH1-Stick"
	set Throttle="DCS-UH1-Throttle"
	set Bodnar="DCS-UH1-Bodnar"
	set Quadrant="DCS-UH1-Quadrant"
	set MFD1="#empty"
	set MFD2="#empty"
) ELSE IF  "%usim%"=="%M2000C_ID%" (
	REM DCS:M-2000
	set Stick="DCS-M-2000-Stick"
	set Throttle="DCS-M-2000-Throttle"
	set Bodnar="DCS-M-2000-Bodnar"
	set Quadrant="DCS-M-2000-Quadrant"
	set MFD1="DCS-M-2000-MFD1"
	set MFD2="DCS-M-2000-MFD2"
) ELSE IF  "%usim%"=="%P51D_ID%" (
	REM DCS:P-51
	set Stick="DCS-P-51-Stick"
	set Throttle="DCS-P-51-Throttle"
	set Bodnar="DCS-P-51-Bodnar"
	set Quadrant="DCS-P-51-Quadrant"
	set MFD1="#empty"
	set MFD2="#empty"

REM Other Flight Sims

) ELSE IF  "%usim%"=="f" (
	REM BMS
	set Stick="#TIR-Stick"
	set Throttle="#PTT-Throttle"
	set Bodnar="#empty"
	set Quadrant="#empty"
	set MFD1="#empty"
	set MFD2="#empty"
	
) ELSE IF  "%usim%"=="e" (
	REM Elite Dangerous
	set Stick="#empty"
	set Throttle="#PTT-Throttle"
	set Bodnar="#empty"
	set Quadrant="#empty"
	set MFD1="Elite-MFD"
	set MFD2="#empty"

) ELSE IF  "%usim%"=="c" (
	REM CloDo
	set Stick="Clodo-Stick"
	set Throttle="Clodo-Throttle"
	set Bodnar="Clodo-Bodnar"
	set Quadrant="#empty"
	set MFD1="#empty"
	set MFD2="#empty"

REM Other Sims

) ELSE IF  "%usim%"=="a" (
	REM Assetto Corsa (Flight Devices need to be disonnected - Stick becomes Wheel = first device)
	set Wheel="#PTT-G25"
	set Stick="%Wheel%"

REM Abort

) ELSE IF  "%usim%"=="0" (
	REM Nothing
	echo Nothing to feed!
	ping 127.0.0.1 -n 3 > nul
	Exit

REM Error Handling

) ELSE (
	COLOR 0C
	echo Wrong Input! Aborting....
	ping 127.0.0.1 -n 3 > nul
	Exit
)

REM loading programs

echo ...Done!
echo.
IF NOT "%usim%"=="0" (
	echo Launching Joystick Key Mapper...
	start "X-Padder" "C:\Tools\Xpadder\Xpadder.exe" %Stick% %Throttle% %Bodnar% %Quadrant% %MFD1% %MFD2%
	echo ...Done!
	echo.
)

echo Launching TrackIR...
start "TrackIR" "C:\Program Files (x86)\NaturalPoint\TrackIR5\TrackIR5.exe"
echo ...Done!
echo.
echo Launching Teamspeak...
start "TS3" "C:\Program Files (x86)\TeamSpeak 3 Client\ts3client_win32.exe"
echo ...Done!
echo.
echo Ready for Takeoff!

ping 127.0.0.1 -n 10 > nul
echo Clear

The main idea of this file is to be launched before you launch your actual sim.

I use the little independent tool Xpadder to externally load profiles / keyboard-mappings for 6 of my 7 game controllers:

Stick = G940 Stick
Throttle = G940 Throttle
Bodnar = Homepit Switchpanel using a Bodnar USB Controller
Quadrant = Saitek Throttle Quadrant
MFD#1 & 2 = Thrustmaster Cougar MFDs

For some retro games that support only one joystick (Hello Mr. X-Wing) I have installed vJoy which allows me to map any of my controllers’ axis and buttons to one virtual stick. This virtual device can use axis and buttons from different physical devices.

Most of the code is dedicated to selecting the right profiles for the selected sim / plane. This allows me to use only one tool instead of three vendor profilers (Logitech, Saitek, Thrustmaster) and more importantly it allows me to map two different action to my switches on my home built Bodnar powered panel (something which is not possible using in game profiles). Another benefit is that I am not afraid of DCS updates deleting my controller mappings :wink:

So if we go through the script from top to bottom we can see following:

  • lines 4-19: declaration of shortcuts that need to be typed into the prompt
  • lines 21-47: Old school text based menu with prompt to enter selection
  • lines 50-240: fill variables with filenames of my xpadder profiles
  • lines 244-257: some error handling
  • lines 261-278: Launch of the programs that I need: XPadder, TrackIR and Teamspeak
  • lines 280-281: Ping yourself to display cmd window for some time before automatically closing it

Usage is pretty simple. Start the .bat, enter character from menu and hit return.

Feel free to modify for your needs.

Obviously you would have to update file paths and most likely you don’t need all this profile selection stuff and can trim down the code :wink:

5 Likes

miRage…thanks that’s it