Hello everyone,
I am new to this forum and VC but I did decide that tonight I would solve the issue of using Wolfram Alpha in VC. I have actually been working on an unofficial add-on or expansion to VC since I came across it which is designed to make it more human like. When I came across VoxCommando I was impressed to say the least at just how polished it is and loved the integration of plugins and logic.
So to get on with the original reason for this post. I have decided to provide the code and basic instructions for using Wolfram Alpha with your own system using some of the code I developed for the cloud based home automation "intelligence" platform I am working on. This is only the beginning as I also plan to expand the options to control a variety of "Internet of Things" that are currently available on the market today.
So it works and I will explain just how to use it right now in your own system.
1. You need a free Wolfram Alpha Developer ID. Get one here if you don't have one already -->
https://developer.wolframalpha.com/portal/apisignup.html2. You need to enable the RoboBrowser Plugin (if it isn't already)
3. You will need a web host or server that runs PHP (or use your Windows PC running PHP and Apache. Use as
http://localhost3. You will need to copy and paste the code below into a new Command
<command id="393" name="General Test" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>RoboB.Select</cmdType>
<cmdString>WolframAlpha</cmdString>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RoboB.Show</cmdType>
<cmdString />
<cmdRepeat>0</cmdRepeat>
</action>
<action>
<cmdType>RoboB.Navigate</cmdType>
<cmdString>http://YOUR_WEB_SERVER_HERE/wolfram.php?k=YOUR_ID_GOES_HERE&t=4&q={1}</cmdString>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RoboB.Wait</cmdType>
<cmdString />
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RoboB.ElementByID</cmdType>
<cmdString>result</cmdString>
<cmdRepeat>1</cmdRepeat>
</action>
<if ifBlockDisabled="False" ifNot="False">
<ifType>LastActionSuccess</ifType>
<ifParams>&&</ifParams>
<then>
<action>
<cmdType>RoboB.GetText</cmdType>
<cmdString />
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>TTS.Speak</cmdType>
<cmdString>{LastResult}</cmdString>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>VC.StopMacro</cmdType>
<cmdString />
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else>
<action>
<cmdType>TTS.Speak</cmdType>
<cmdString>I'm sorry, I don't understand</cmdString>
<cmdRepeat>1</cmdRepeat>
</action>
</else>
</if>
<phrase>tell me, define, lookup</phrase>
<payloadDictation>payloadDictation: Regular</payloadDictation>
</command>
4. Next modify the URL to include your web host/server address and your own Wolfram Alpha Developer ID (Application ID)
Now for a quick breakdown of the URL:
k=YOUR_ID_GOES_HERE (this part should be obvious but make sure the & is left after the ID)
t=4 (There are 4 settings, 1 = Result Only, 2 = Details Only, 3 = Notable Only, 4 = Result + Details + Notable) - You will need to use the robo getelementbyID and gettext options demonstrated in the example code to get the data you want, options are (result, detail, notable)
And yes, a short explanation on what these are.. 1. result is the short answer (i.e. if the question was "who was the first man on the moon" then result would be Neil Armstrong. 2. details are like the full persons name and their DOB and maybe some other details. 3. Notable is a summary of the persons achievements or what they are known for. This can also be the meat of the text response.
q={1} ( this is the query string that comes from the dictation payload - note you can add static text before or after the {1} such as "who is " or "what is " if you want)
I have attached the PHP script you will need to this post. Feel free to modify it and improve upon it.
Just wanted to help solve one of these feature requests and make it future proof and easily updatable and now your system can be as smart as Wolfram Alpha. Remember you have up to 2,000 free requests per month with the developer ID so have fun with it! Let me know if you have any questions.