In order to call python with a parameter you need to define a function (or method, whatever it is called in python). You do this in a .py file which you load using the PY.ExecFile action. This only needs to be done once so you could put it in a command that is triggered by the VC.Loaded event.
Once that has been done you can call the function using PY.ExecString action.
so for example, your python file (which you can load at startup using PY.ExecFile) might look like this:
import ctypes
def sendWsrMessage(iMsg):
SendMessage = ctypes.windll.user32.SendMessageW
FindWindow = ctypes.windll.user32.FindWindowA
handle = FindWindow(b"MS:SpeechTopLevel",None)
if handle:
SendMessage(handle, 273, iMsg, 0)
result = 1
else:
result = 0
def wsrOn():
sendWsrMessage(101)
def wsrOff():
sendWsrMessage(102)
and then you could use these commands to turn WSR on and off.
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="WRS Start Stop" enabled="True" prefix="" priority="0" requiredProcess="" description="">
<command id="188" name="windows speech recognition start" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>PY.ExecString</cmdType>
<cmdString>wsrOn()</cmdString>
<cmdRepeat>1</cmdRepeat>
</action>
</command>
<command id="199" name="windows speech recognition stop" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>PY.ExecString</cmdType>
<cmdString>wsrOff()</cmdString>
<cmdRepeat>1</cmdRepeat>
</action>
</command>
</commandGroup>