Hi Rio,
1. Remember to be careful with your 2 Google.TTS commands. If you try to create new commands that are triggered with the same events and command names that you already use for your text-to-speech, you will have many problems.
2. Your {LastResult} did not work because your Google.TTS command was not originally designed to capture and store the Arabic text in VoxCommando.
The original Google.TTS RoboBrowser command works by literally typing the text that you want spoken aloud on the Google Translate webpage, and then automatically clicking on the "Listen" button that appears on that page. The RoboBrowser window is hidden, so we don't see it. The audio is coming from the hidden RoboBrowser window.
3. In this case, you want to display the English text and its Arabic translation. That requires that we actually
capture the Arabic text from the hidden RoboBrowser window, so that we can use it in VoxCommando.
i. First we need to select the correct field ("Element") on the Google Translate page. To find the correct element, we need to "show" the RoboBrowser window temporarily so that we can see what is happening.
Now we can use our RoboBrowser "Investigator" Tool to find the ID for that text field. We discover that the ID is called "result_box".
[See attached image]
ii. Once we've selected that element in our command, we can capture the text in "result_box", using the action
RoboB.GetText.
iii. That text will now be stored in {LastResult}.
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.9-->
<commandGroup open="True" name="translation en to ar" enabled="True" prefix="" priority="0" requiredProcess="" description="">
<command id="430" name="Translate English to Arabic" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="triggered by an event expecting 2 payloads
{1} text to speech
{2} language code">
<action>
<cmdType>RoboB.Select</cmdType>
<params>
<param>GoogleTranslateEn2Ar</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RoboB.Navigate</cmdType>
<params>
<param>https://translate.google.com/#en/{2}/{1}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<event>GoogleTranslate</event>
</command>
<command id="409" name="GoogleTranslation page loaded" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="triggered by an event expecting 2 payloads
{1} text to speech
{2} language code">
<action>
<cmdType>RoboB.Select</cmdType>
<params>
<param>GoogleTranslateEn2Ar</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RoboB.ElementByID</cmdType>
<params>
<param>result_box</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RoboB.GetText</cmdType>
<params />
<cmdRepeat>1</cmdRepeat>
</action>
<if ifBlockDisabled="False" ifNot="False">
<ifType>LastActionSuccess</ifType>
<ifParams>&&</ifParams>
<then>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>{var.EnglishText} = {LastResult}</param>
<param>10000</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>Translation unsuccessful.</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</else>
</if>
<event>RoboB.DocComplete.GoogleTranslateEn2Ar</event>
</command>
<command id="542" name="translate" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="40" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>VC.TriggerEvent</cmdType>
<params>
<param>GoogleTranslate</param>
<param>{1}</param>
<param>ar</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.SetVar</cmdType>
<params>
<param>EnglishText</param>
<param>{1}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<phrase>say</phrase>
<payloadDictation>payloadDictation: Regular</payloadDictation>
</command>
</commandGroup>