Welcome to Synthiam!

Program robots using technologies created by industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation, and artificial intelligence easy.

Get Started
Asked — Edited

Rss News

Hey guys, here is a script I have been working on. It reads the Rss News and after it is done with the first story it asks you if you want to continue. If you say "Yes" it will continue to the second story, and if you say "NO" it will end the script. I didn't know if this was posted already somewhere but I thought I would share it anyways . RSSNEWS.EZB:D

AI Support Bot
Related Content
Synthiam
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
United Kingdom
#7  
You can get rid of it from the start yes. However, I generally set out all variables at the start of a script for three reasons;
1. To avoid any errors if the variable isn't defined before any IF or calculations.
2. To reset all variables if a script is stopped then restarted.
3. So I know what the variables are (the amount I use I tend to lose track)

While it may be redundant and makes the script longer I prefer it that way, but that's just my way I guess, each person will do things differently.
#8  
Why do I only get the same news item, it does not read me the next. Other than that it works great.
United Kingdom
#9  
Ill look when I get home, I guess you need to increment the story line variable or something:)
United Kingdom
#10  
I re-wrote the script, I just tested it and it moves to the next story too.

Code:

# RSS News Reading Script
# Author: Rich Pyke
# Version: 1.0.0
#
# RSS Script for reading news from RSS posts. Adapted from cafasarus
# script at http://www.ez-robot.com/Community/Forum/posts.aspx?threadId=3650

# Define variables
$feedurl = "http://feeds.reuters.com/Reuters/domesticNews";

# Do not change these variables
$storyLn = 0

# Start the code
:begin
# Increment the story line by 1
$storyLn++
# Print the story number
Print($storyLn)
# Speak the story
SpeakRSSDescription($feedurl,$storyLn)
SayWait("Would you like me to continue?")
# Ask if it should continue to the next story
$response = WaitForSpeech(10,"YES","NO")
# If yes
IF ($response = "YES")
# Go back to the start
Goto(begin)
# Otherwise
ELSE
# Say OK
SayWait("Ok")
ENDIF
# End of script
Halt()


I uploaded it to the cloud too, click here to download

The RSS Feed URL is a variable at the start of the script, this can be changed for any valid RSS feed at the top of the script, just change the url in the quotes. No need to change the script other than that:)

The script is the only control in the project which should make importing it in to your current ARC project through the merge feature very simple to do.

Code is commented as per usual to help aid you in learning why the commands are there and what they do.

Enjoy:)
PRO
USA
#11  
cafasaru and rich, thank you. That is an excellent addition to my Captain Ann Droid, along with the weather. I used the merge for the first time. There are so many talented people on EZB community.
Thank You
Steve S
United Kingdom
#12  
Steve, you should be able to use the code i posted to pick up any RSS, including the EZ-Robot forum RSS feed.

More is on the way too:)
United Kingdom
#13  
@Rich.

Reviving an old thread but this was an interesting one. I have a quick question I hope you can help with.

I tried out your script for the RSS news feed with a ControlCommand() in a speech synthesis control and it worked well (had to add comma's to the url), except for one thing. When the speech synth says "would you like to continue" it then quickly says "ok" before I say anything, and when I do say yes, nothing happens. Any thoughts to remedy this?
United Kingdom
#14  
What commas did you need to add? The script syntax hasn't changed since this one was posted so it shouldn't need any changing other than the feed url (if required).

Also the script should work fine and wait for 10 seconds for a yes or no response at the line with WaitForSpeech() in it. If it's not then it indicates that it has heard something which resembles "no" or it is timing out hence it saying OK and ending. Check your speech recognition training, your microphone and any speech controls added to the project.

You could change the Else to an ElseIf($response = "NO") and then add a further Else before the EndIf with SayWait("An error has occured"), this would help pinpoint where the issue may lie...

Like this;

Code:


# RSS News Reading Script
# Author: Rich Pyke
# Version: 1.0.0
#
# RSS Script for reading news from RSS posts. Adapted from cafasarus
# script at http://www.ez-robot.com/Community/Forum/posts.aspx?threadId=3650

# Define variables
$feedurl = "http://feeds.reuters.com/Reuters/domesticNews";

# Do not change these variables
$storyLn = 0

# Start the code
:begin
# Increment the story line by 1
$storyLn++
# Print the story number
Print($storyLn)
# Speak the story
SpeakRSSDescription($feedurl,$storyLn)
SayWait("Would you like me to continue?")
# Ask if it should continue to the next story
$response = WaitForSpeech(10,"YES","NO")
# If yes
IF ($response = "YES")
# Go back to the start
Goto(begin)
# Otherwise
ELSEIF($response = "NO")
# Say OK
SayWait("Ok")
ELSE
SayWait("An error has occured")
ENDIF
# End of script
Halt()


Also note that the project I uploaded to the cloud is not intended to be a stand alone project but one for the script to be merged from or copy and pasted from.

Another note, the forum is adding an extra ; in the feedurl line, it's not needed. Download the project from the cloud and adapt the script from there with the lines mentioned above.
United Kingdom
#15  
Thanks for getting back to me Rich. Below is the section of code I had to add the commas to.

Code:

# Define variables
$feedurl = "http://feeds.reuters.com/Reuters/domesticNews"



Code:

# Define variables
$feedurl = ("http://feeds.reuters.com/Reuters/domesticNews")


Without the commas, it wouldn't work for me and was coming up with an error. With commas added it worked fine (I also took out the ; you mentioned). I did also change the url the BBC news after a few try's which also worked great but still unable to continue.

The speech recognition couldn't have picked anything else up as the room I was in was in complete silence, and when it was saying "ok" it was instantly after it says would you like to continue, no time to hear anything anyway.

I admit that I did run the script as a stand alone with the exception of the speech recognition control, and set a ControlCommand() to start the script control with the phrase "tell me the news" which worked really well. I only did this as a trial before I added it to my main project. I just wondered if the syntax might have changed as this posted a year ago. :)
#16  
Parentheses, not commas. You had us confused.

Alan
United Kingdom
#17  
Oh dear, how embarrassing *blush*. Serves me right for rushing when I type. Yes I meant Parentheses. Thanks for correcting me Alan. ;)
United Kingdom
#18  
They shouldn't be needed. The script runs fine (except for ending before an answer is spoken) without them in 2014.10.28.00 and adding them is not correct syntax unless this has been changed since 2014.10.28.00

As far as I know WaitForSpeech() isn't broken so I can only assume the premature ending before answering is due to running the script as a stand alone project and not having any speech recognition set up on this PC (or in the project).
United Kingdom
#19  
@Rich.

I do have speech recognition set up with a good headset and is constantly trained so it may be as you say, running it stand alone. I did also add a "yes" and "no" commands to the speech recognition control config along with "tell me the news".

So with running it stand alone possibly being the cause, can I ask what do you suggest I could run it with (another script or control)? I think the RSS script you came up with is pretty cool and would love to get it fully working.

Cheers.

P.s. @Rich. love the new avatar by the way :P.
#20  
Maybe your ARC or RSS is hearing itself? Mine does that occasionally if I have the volume too loud...

Possibly a moot point since you said you wear a headset.... but maybe something to consider...
United Kingdom
#21  
@Steve, it's a subtle hint at what I'm doing this month, I'll be reviving an old topic from around a year ago later this month;)

@Richard, I think it's more a case of it not waiting to hear anything as on a quick test mine went straight to finishing, since it ends with just an Else not ElseIf, anything other than hearing a "Yes" will end it, hence the addition of a few lines of code mentioned previously.
I only tested it on one PC with no VR set up, no mic etc. so it's not hearing itself. I'll have another look later on my HTPC which is what I wrote it on and see if I can figure out the problem.
United Kingdom
#22  
@Rich.

That's Brilliant. Thanks for looking in to this for me. And a cant wait to see what you have in store later in the month. I really enjoy reading your content and you are a real asset to the community with your help and advice. Great stuff. :D.

@Richard.

Yeah that did cross my mind too, thinking that the headset mic was picking up something. But even with the laptop volume turned right down it had no effect. Good thinking though, and thanks. (Btw, your a great asset too). ;)
United Kingdom
#23  
@Rich.

I just had a go at trying the script you supplied in post #15, but it's still not waiting for a response after it says "Would you like me to continue?" and immediately says "An error has occurred" and get the following message...

User-inserted image


On thing about this script, it no longer needs the brackets needed now. Did you get a chance to see what could be causing the error?
United Kingdom
#24  
I haven't however the error message you posted says why there is an error.

This is going from memory back 18 months to a couple of years but the speech profile needs to be English US not English GB (as I assume you have it set, as do I on the PC I tested it on). Changing the speech profile to English US may solve it however it also means you need to re-train.
United Kingdom
#25  
I thought that's what the error message meant. You assume correctly, I do have my system set up for English GB. I don't fancy re-training my speech rec so I looked at going a different way.

I found the RSS jokes in ARC examples, put in BBC's news rss and worked fine, but where and what do I put so while the feed is being read, I can say something like "stop reading" to the voice rec and it does just that? I tried a few different ways but none of them worked. Any ideas?

Cheers.
United Kingdom
#26  
Just to elaborate on the question I posted above, I am trying to find a way to stop an RSS feed from being read out at any point while it's being read by using a speech recognition control, and so far have not had any luck. I have tried script commands such as,

Stop Audio,
Speak Stop,
Control command scrip stop,
Control command script pause,
and
Control command script start for the RSS stop script control in the RSS jokes example.

Non of which which will execute until the entire RSS feed has been read. The manual stop script control works fine but would love to do this via speech recognition. Still being new at scripting I am out of ideas to how I can achieve this so any ideas would be most welcome.
:)