Author Topic: Introducing python scripting for VoxCommando  (Read 7148 times)

0 Members and 1 Guest are viewing this topic.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Introducing python scripting for VoxCommando
« on: February 21, 2013, 10:14:03 AM »
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
« Last Edit: April 27, 2015, 02:33:28 PM by nime5ter »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Introducing python scripting for VoxCommando
« Reply #1 on: February 21, 2013, 02:05:58 PM »
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

Code: [Select]
<?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

  • $upporter
  • Sr. Member
  • *****
  • Posts: 366
  • Karma: 9
  • Crunchie
    • View Profile
Re: Introducing python scripting for VoxCommando
« Reply #2 on: February 23, 2013, 11:29:42 AM »
Thanks James. Can't wait to try this some day.
Neural Net Based Artificial Intelligence.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Introducing python scripting for VoxCommando
« Reply #3 on: February 23, 2013, 11:44:57 AM »
I recommend you get 0984 in order to test this

http://voxcommando.com/forum/index.php?topic=1007.0