News:

HOT TIP! Enable the History Window in the main UI when trying to problem solve. It provides a handy log of what is happening. Roll over lines in the History to get more details.

Main Menu

Introducing python scripting for VoxCommando

Started by jitterjames, February 21, 2013, 10:14:03 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

jitterjames

I am very excited to announce a new plugin that will allow us to do python scripting in VoxCommando.  This opens up a whole new world of possibilities for voxCommando, and for those of you who are new to programming, it will be an excellent way to get your feet wet, and learn from others.

For starters, take at look at the new wiki page about python for VC:
http://voxcommando.com/mediawiki/index.php?title=Python

UPDATE: STEP 1 IS NOT NECESSARY ANY MORE. THE PY PLUGIN IS A STANDARD PLUGIN THAT CAN BE ENABLED UNDER THE OPTIONS > PLUGINS TAB.

When you are ready to get started:

1) Download this zip file and extract it directly into your VoxCommando directory.
http://voxcommando.com/files/extras/python.zip

This will create a PY folder with a sample script "VoxCommando\PY\" which will be a good place to keep your python scripts.  It will also create the python plugin folder with all the necessary files and python libraries.

2) Then, as with any plugin you will need to go to options to enable the plugin
3) ... and restart VC

jitterjames

Here's a very simple example that lets us do some basic math.  You can ask questions as follows:

what is 4 times 5
what is 98 divided by 11
what is 12 plus 19
what is 100 minus 33

Maybe not very useful but it gives you an idea of what we can do with only one line of python code!

I have only included the numbers from 1-100 and the 4 basic math operators:  + - * /

paste the following code into your tree and put the attached .xml file in your payloads folder

<?xml version="1.0" encoding="utf-16"?>
<command id="245" name="what is {1} {2} {3}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
 <action>
   <cmdType>PY.ExecString</cmdType>
   <cmdString>result = {1}.0 {2} {3}</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>OSD.ShowText</cmdType>
   <cmdString>{LastResult}</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>TTS.Speak</cmdType>
   <cmdString>{LastResult}</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <phrase>what is</phrase>
 <payloadRange>1,100</payloadRange>
 <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone">payloads\mathoperators.xml</payloadFromXML>
 <payloadRange>1,100</payloadRange>
</command>

xtermin8r

Thanks James. Can't wait to try this some day.
Neural Net Based Artificial Intelligence.

jitterjames