@Echo Off
Cls
Setlocal Enabledelayedexpansion



Rem ====================================================================================
Rem Укажите Путь К Корневой Папке Симулятора!
Rem ╙ърцшЄх яєЄ№ ъ ъюЁэхтющ яряъх ёшьєы ЄюЁр!

Set Simroot="C:\Microsoft Flight Simulator X"













Rem ====================================================================================
Set Simroot=%Simroot%\Sound\CREWRD\Briefing
Set Aircraft=%Simroot%\Aircraft\Favorite
Set Aircompany=%Simroot%\Aircompany
Set Depart=%Simroot%\Departure\Favorite
Set Destin=%Simroot%\Destination\Favorite
Set Hours=%Simroot%\Hours
Set Mins=%Simroot%\Minutes
Color 1f

Set Ansver=Y
Echo.
Echo ================================================================
Echo Это скрипт подготовки предполетного брифинга КВС
Echo на основе указанных вами данных.
Echo ================================================================
Echo.
Echo.
Echo Для выбора самолета и авиакомпании введите 1,
Set /P Ansver="чтобы пропустить этот шаг просто нажмите Enter: "
If /I %Ansver%==1 (Goto Aircraft ) Else (Goto Flightplan)


:Aircraft

Cls
Echo.
Echo ================================================================
Echo Часть 1. Выбор названия самолета и авиакомпании
Echo ================================================================
Echo.
Echo Для выбора варианта укажите порядковый номер и нажмите Enter.
Echo.
Echo.
Set N=1
For /F "Usebackq Delims=." %%I In (`Dir /B %Aircraft%`) Do Echo !N!. %%I & Set /A N=!N!+1
Echo.
Set /P Youraircraft="Выберите самолет (Если нет, просто нажмите Enter): "
If Defined Youraircraft (
Set N=1
For /F "Usebackq" %%I In (`Dir /B %Aircraft%`) Do If !Youraircraft!==!N! (Set Youraircraft=%%I) Else (Set /A N=!N!+1)
)

Cls
Echo.
Set N=1
For /F " Usebackq Delims=." %%I In (`Dir /B %Aircompany%`) Do Echo !N!. %%I & Set /A N=!N!+1
Echo.
Set /P Youraircompany="Выберите авиакомпанию (Если нет, просто нажмите Enter): "

If Defined Youraircompany (
Set N=1
For /F "Usebackq" %%I In (`Dir /B %Aircompany%`) Do If !Youraircompany!==!N! (Set Youraircompany=%%I) Else (Set /A N=!N!+1)
)

Echo.
Echo ================================================================
If Defined Youraircraft (
Echo Выбрано: Самолет %Youraircraft:~0,-4% 
) Else (
Echo Выбрано: самолет 
)
If Defined Youraircompany (Echo авиакомпании "%Youraircompany:~0,-4%")

Echo.
Echo.


Pause


If Defined Youraircraft (
If Defined Youraircompany (
Copy /B %Simroot%\Briefing1.mp3+%Aircraft%\%Youraircraft%+%Simroot%\Briefing2.mp3+%Aircompany%\%Youraircompany% %Simroot%\Briefing12.mp3
) Else (
Copy /B %Simroot%\Briefing1.mp3+%Aircraft%\%Youraircraft% %Simroot%\Briefing12.mp3
)
) Else (
If Defined Youraircompany (
Copy /B %Simroot%\Briefing1.mp3+%Simroot%\Briefing2.mp3+%Aircompany%\%Youraircompany% %Simroot%\Briefing12.mp3
) Else (
Copy /B %Simroot%\Briefing1.mp3 %Simroot%\Briefing12.mp3
)
)

:Flightplan
================================================================================================================



Cls
Echo.
Echo.
Echo ================================================================
Echo Часть 2. Информация о полете
Echo ================================================================
Echo.

Echo Для выбора варианта укажите порядковый номер и нажмите Enter.
Echo.

Set N=1
For /F "Usebackq Delims=." %%I In (`Dir /B %Depart%`) Do Echo !N!. %%I & Set /A N=!N!+1
Echo.
Set /P Departure="Выберите аэропорт отправления (Если нет, просто нажмите Enter): "

If Defined Departure (Goto Case2) Else (Goto Case3)
:Case2
Set N=1
For /F "Usebackq" %%I In (`Dir /B %Depart%`) Do If !Departure!==!N! (Set Departure=%%I) Else (Set /A N=!N!+1)
Echo.


Cls
Set N=1
For /F "Usebackq Delims=." %%I In (`Dir /B %Destin%`) Do Echo !N!. %%I & Set /A N=!N!+1
Echo.
Set /P Destination="Выберите аэропорт назначения: "

Set N=1
For /F "Usebackq" %%I In (`Dir /B %Destin%`) Do If !Destination!==!N! (Set Destination=%%I) Else (Set /A N=!N!+1)


:Case3

Cls
Echo.
Echo Укажите информацию о времени полета
Echo ===========================================================
Echo.
Echo.
Set /P Flighthours="Сколько часов (Если менее часа, просто нажмите Enter): "
If Defined Flighthours Set Flighthours=%Flighthours%H.mp3 

Set /P Flightmins="Сколько минут (x10. Если нет, просто нажмите Enter): "
if not defined Flightmins goto Case4
If Flightmins Gtr 9 Set Flightmins=%Flightmins:~0,1%
Set Flightmins=%Flightmins%0m.mp3
:Case4
Echo.
Echo.
Echo ================================================================

If Defined Departure (Echo Выбрано: перелет %Departure:~0,-4%-%Destination:~0,-4%)

Echo.
Echo Время в пути: 
If Defined Flighthours Echo %Flighthours:~0,-6% Час(а,ов) 
If Defined Flightmins Echo %Flightmins:~0,-5% Минут. 

If Not Defined Flighthours Set Flighthours=0.mp3
If Not Defined Flightmins Set Flightmins=0.mp3

Echo.
Echo.
Pause


If Defined Departure (
Copy /B %Simroot%\Briefing12.mp3+%Simroot%\Briefing3.mp3+%Depart%\%Departure%+%Destin%\%Destination%+%Simroot%\Briefing4.mp3+%Hours%\%Flighthours%+%Mins%\%Flightmins%+%Simroot%\Briefing5.mp3 %Simroot%\Briefing.mp3
Copy /B %Simroot%\Kvs_bye1.mp3+%Simroot%\Kvs_bye2.mp3+%Destin%\%Destination%+%Simroot%\Kvs_bye3.mp3 %Simroot%\Kvs_bye.mp3
) Else (
Copy /B %Simroot%\Briefing12.mp3+%Simroot%\Briefing4.mp3+%Hours%\%Flighthours%+%Mins%\%Flightmins%+%Simroot%\Briefing5.mp3 %Simroot%\Briefing.mp3
Copy /B %Simroot%\Kvs_bye1.mp3+%Simroot%\Kvs_bye3.mp3 %Simroot%\Kvs_bye.mp3
)

%Simroot%\Lame --Decode %Simroot%\Briefing.mp3 %Simroot%\Kvs_briefing.Wav
%Simroot%\Lame --Decode %Simroot%\Kvs_bye.mp3 %Simroot%\Kvs_bye.Wav

Del %Simroot%\Briefing.mp3
Del %Simroot%\Kvs_bye.mp3

Cls
Echo Готово.
Echo.
Echo.
Pause


