When you start VoxCommando the variable has no value. The way you created your logic block, both commands will fail because the variable is not equal to either 0 or 1.
Also in your second command ("stop recording"), you have entered the wrong parameter in the Results.Setvar action. You have written {var.rec} but you should have written rec. The "start recording" command was done correctly.
I changed the logic for you. The attached commands should work. I changed:
if (rec==0)
to if (rec <> 1)
and
if (rec==1)
to if (rec <> 0)
This way they will work when the variable has not been assigned a value yet.
Remember:
1) If you are already recording when VoxCommando first starts then you will have a problem.
2) If you manually press Ctrl-R on your keyboard VoxCommando will not know about it and your variable will have the wrong value, and your voice commands will not work correctly until you press Ctrl-R again.
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.6-->
<commandGroup open="True" name="La-5" enabled="True" prefix="" priority="0" requiredProcess="" description="">
<command id="94" name="Запись полета" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<if ifBlockDisabled="False" ifNot="True">
<ifType>(A)==(B)</ifType>
<ifParams>{var.rec}&&1</ifParams>
<then>
<action>
<cmdType>DxInput.KeyCombo</cmdType>
<params>
<param>{LeftControl}</param>
<param>{R}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.SetVar</cmdType>
<params>
<param>rec</param>
<param>1</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>TTS.Speak</cmdType>
<params>
<param>Запись включена</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else>
<action>
<cmdType>TTS.Speak</cmdType>
<params>
<param>Запись уже идет</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</else>
</if>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>{var.rec}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<phrase>Записать полет,запись полета,включить запись,сохранить запись</phrase>
</command>
<command id="107" name="Остановить запись" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<if ifBlockDisabled="False" ifNot="True">
<ifType>(A)==(B)</ifType>
<ifParams>{var.rec}&&0</ifParams>
<then>
<action>
<cmdType>DxInput.KeyCombo</cmdType>
<params>
<param>{LeftControl}</param>
<param>{R}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.SetVar</cmdType>
<params>
<param>rec</param>
<param>0</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>TTS.Speak</cmdType>
<params>
<param>Запись выключена</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else>
<action>
<cmdType>TTS.Speak</cmdType>
<params>
<param>Запись не была включена</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</else>
</if>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>{var.rec}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<phrase>Остановить запись,Сохранить запись,Прекратить запись</phrase>
</command>
</commandGroup>