Python version as follows. You need to enable the Python plugin in VoxCommando for this to work.
VC commands group:
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.3.2-->
<commandGroup open="True" name="python random" enabled="True" prefix="" priority="0" requiredProcess="" description="">
<command id="1151" name="load python script" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>PY.ExecFile</cmdType>
<params>
<param>PY\randomMsg.py</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<event>VC.Loaded</event>
</command>
<command id="1152" name="test tts message" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Results.SetLastResult</cmdType>
<params>
<param>My name is Simon|Hello there|4|5|6|7|8</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>PY.ExecString</cmdType>
<params>
<param>randomMsg("{LastResult}")</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</command>
</commandGroup>
Python script (randomMsg.py) attached. It needs to go in the PY folder of your VC directory (or you need to change the file path in the VC command).
The lines that start with '#' are not code, but comments to the reader.
Pasted here for other users who may be interested in the code:
import urllib
import random
def randomMsg(tts):
mavericAPIkey= "Enter your API KEY here in quotes (in quotes defines it as a string in Python)"
ttsList=tts.split("|")
myMsg=random.choice(ttsList)
vc.callAction("TTS.Speak",myMsg, None)
vc.callAction("OSD.ShowText",myMsg, None)
#if you want to use VC, uncomment (remove #) the following line:
#vc.callAction("Scrape","http://autoremotejoaomgcd.appspot.com/sendmessage?key="+mavericAPIkey+"&message=jarvistalk=:="+myMsg,None)
#the line below calls the URL directly from python. You'll need to test this.
urllib.urlopen("http://autoremotejoaomgcd.appspot.com/sendmessage?key="+mavericAPIkey+"&message=jarvistalk=:="+myMsg)