Create a speak the time macro with Vocola?

Is it possible to use the function TTSPlayString or MsgBoxConfirm through Vocola?

I am trying to create a command to "tell" me the time.
This is what I tried using both.

what time is it = MsgBoxConfirm "The current time is %time%", 64 , Time + TTSPlayString

<?php
time
?>

Thanks for any help.

Don

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

If you can do this, it is

If you can do this, it is better to do it in natpython.

Study that first, there are sample macro's for comparable things,

Quintijn

rowead's picture

Here some code for an

Here some code for an advanced scripting NaturallySpeaking command. It will speak the time.

Sub Main

Dim sTime As String, iMinute As Integer

Select Case Format( Now, "n" )
Case "15"
sTime = "Quarter past " & Format( Now, "h AMPM" )
Case "30"
sTime = "half past " & Format( Now, "h AMPM" )
Case "45"
sTime = "Quarter to " & Format( DateAdd( "h", 1, Now ), "h AMPM" )
Case "0"
sTime = Format( Now, "h AMPM" )
Case Else
iMinute = Val( Format( Now, "n" ) )
If iMinute < 30 Then
sTime = iMinute & " minutes past " & Format( Now, "h AMPM" )
Else
sTime = 60 - iMinute & " minutes to " & Format( DateAdd( "h", 1, Now ), "h AMPM" )
End If
End Select
' MsgBox sTime

TTSPlayString sTime

End Sub

KnowBrainer's picture

 We cannot tell you how to

 We cannot tell you how to do this in Vocola but if you're unable to figure it out, the command already exists in KnowBrainer 2006.  All you have to do is say “What Time Is It”.  KnowBrainer will visually and verbally tell you the time. 1 of the nice things about KnowBrainer is that many of the commands you would want to create with Vocola already exist in KB 2006.  It all boils down to what your time is worth.

 

KnowBrainer Support Staff - Lunis Orcutt

Dictated with DNS 9, KnowBrainer and UniVoice

 

Don, This isn't quite what

Don,

This isn't quite what you asked for, but it may be adequate. The following code will open the date/time application in Windows, wait four seconds, and close the date/time application.

ShellExecute "control timedate.cpl", 3
wait 4000
SendSystemKeys "{Alt+F4}"

If you really need to have the time spoken, there are various freeware and shareware utilities that can be found on the Internet that will accomplish this task.

Bruce

This is what I have so

This is what I have so far.

what time is it = SetMicrophone(0) TTSPlayString(%time%) SetMicrophone(1) ;

this will turn off the microphone, play the stream, and then turn the microphone back on.

What I need now is what to insert where %time% is so that it captures the current time.
What it does now is turn off the microphone, actually speak "percent time percent" ,
and turn the microphone back on.

Does anyone know how to get this information?
I have used Google searching for Mac grows and time and come up with multiple different versions
but any symbols I put in there or spoken as a word versus the actual time. Or dragon pops up a message saying that it's unable to play the string.

I have looked at the freeware and shareware utilities that will tell me that time, but that just means one more program running when there has to be a way to do this through vocola in the macro without extra resources being used.

Don

KnowBrainer's picture

We are not fluent with

We are not fluent with Vocola for obvious reasons but you could create a command that opens Notepad, types the system time into Notepad, copies the text, initiates the text-to-speech engine to read the text and then exits the document without saving.  You just have to think outside the box.  Of course there's one other option...

 

 

KnowBrainer Support Staff - Lunis Orcutt

Dictated with Preferred 9.5 & KnowBrainer

I do not doubt KnowBrainer

I do not doubt KnowBrainer has a good solution for this.

When seeking for something else, consider the natpython script _SmartTTS.py which is designed to read the clipboard. With natpython it is easy to get the current time in desired format on the clipboard. Moreover this script (from Jonathan Epstein) can make better spoken forms by a special translations file, so things that do not fit well in the standard TTS model will sound better.

(I do not know where you can download this grammar file, but I have kept it, so if anybody wants to try..., with consent of Jonathan I hope)

Quintijn

Here is the description:

Introduction

This package is an add-on for Natural Link (AKA Natural Python), which
in turn is an add-on for NaturallySpeaking.  It performs "smart" preprocessing
on the Windows Clipboard prior to "reading" the Clipboard's contents using
text-to-speech (TTS) technology.  This can make the resulting speech much
more intelligible.  Preprocessing of individual words is highly configurable,
and each user's configuration file is likely to reflect the user's organization,
line of work, etc.
 

Installation:

If you have not already done so, you must install Natural Python
following the instructions provided at the web site:
  http://www.synapseadaptive.com/joel/NatLinkVersion...

Edit the copy of __SmartTTS.py which appears in this archive.  Change
the "translationPath" setting to correspond to where you have unpacked
this archive.  Note that you must use forward-slashes rather than the
backward-slashes (\) typically used in Windows.

Copy the modified __SmartTTS.py file into Natural Link's "MacroSystem"
directory, and then restart NaturallySpeaking.


Usage:

Edit the file translations.txt and add additional phrases to be
converted.  Each line consists of a single word to be translated,
followed by a tab, followed by a translation which is intelligible
when passed to the text-to-speech engine.  Note that each time you modify
translations.txt, these changes are immediately reflected the next
time you say "read Clipboard", with no need to restart NaturallySpeaking.

Make sure you don't have another (NaturallySpeaking professional)
command installed named "read Clipboard".

Load some suitable text into the Clipboard (the contents of this
file would be fine for demonstration purposes) and say "read
Clipboard".

This version can also be invoked from the command-line, enabling
the user to run TTS manually from the keyboard.  For example, create
a Windows shortcut for this file and assign a keystroke combination
within that shortcut's Properties.  Then, for example, you can always
hear the contents of the Windows clipboard by striking Ctrl-Alt-F11.



Future ideas:


There are a lot of other interesting ideas which can be built upon
this simple program.  For example, one could take the output of Joel
Gould's GetWords program, process the pronunciations in some fashion,
and then provide these pronunciations as part of the input to this
program.

Based upon some simple rules, one could adjust the pitch and
speed of the text-to-speech engine to make the output more
intelligible and less monotonous.

It would be nice if there were a way to get accents placed on the
correct syllable.  For example, the word "zebrafish" should be pronounced
with its accent on the first syllable.  If you have figured out a way
to do this, please contact the author.


Author:

Jonathan Epstein (Jona...@nih.gov).  Please give proper
attribution if you redistribute the software in any manner.

Version 1.1, last modified December 18, 2002.

The notepad hint is what I

The notepad hint is what I needed. I was looking at it las night.
This should work, I can't check it until I get home this evening.

What time is it = ShellExecute "notepad" {F5}{Ctrl+A}{Ctrl+X}{Alt+F4} SetMicrophone(0) TTSPlayString()
SetMicrophone(1) ;

Thanks for the help.

Don

Try this. SetMicrophone

Try this.

SetMicrophone 0
AppBringUp "Notepad"
Wait 1000
SendKeys "{F5}"
Wait 500
SendKeys "{Ctrl+a}"
Wait 1000
HeardWord "read","that"
Wait 6000
SendSystemKeys "{Alt+F4}"
Wait 500

Bruce

I finally got it

I finally got it working.
This is the command as it works now.

what time is it = SetMicrophone(0) AppBringUp (Notepad) {F5}{Ctrl+a}{Ctrl+X}{Alt+F4} TTSPlayString() SetMicrophone(1) ;

Bruce,
I started with what you wrote and kept getting Python errors. I think the problem was I didn't know how to correctly format the command. I read through the vocola global commands and figured out how to format the various commands

I started off with your wait times included and slowly started lowering them until I figured out that it would run with no wait times at all. I had to add the {Ctrl+X} so that it would cut the time out of the page otherwise Notepad would want you to save changes before it would close the document.
This where the page is empty and it will close automatically. And puts the time\date on the clipboard
which is read by the TTSPlayString() command.

If you try this command and it doesn't work properly you might have to add the wait times back in.
I guess it depends on how fast your computer is.

Thanks for all the help, I love this forum.

Don

In natpython years ago a

In natpython years ago a small grammar was written by Jonathan Epstein that read text that was put on the clipboard. No intermediate windows necessary. With python it is easy to put the date/time in the format you want on the clipboard.

As additional feature a list of words can be defined with additional "wanted spoken form" in order to make some words or abbreviations sound nicer. I do not know where the grammar can be downloaded, but if somebody wants to try it: it is still on my computer. I hope Jonathan agrees with this message. Below the readme text.

Greetings, Quintijn

Introduction

This package is an add-on for Natural Link (AKA Natural Python), which
in turn is an add-on for NaturallySpeaking.  It performs "smart" preprocessing
on the Windows Clipboard prior to "reading" the Clipboard's contents using
text-to-speech (TTS) technology.  This can make the resulting speech much
more intelligible.  Preprocessing of individual words is highly configurable,
and each user's configuration file is likely to reflect the user's organization,
line of work, etc.
 

Installation:

If you have not already done so, you must install Natural Python
following the instructions provided at the web site:
  http://www.synapseadaptive.com/joel/NatLinkVersion...

Edit the copy of __SmartTTS.py which appears in this archive.  Change
the "translationPath" setting to correspond to where you have unpacked
this archive.  Note that you must use forward-slashes rather than the
backward-slashes (\) typically used in Windows.

Copy the modified __SmartTTS.py file into Natural Link's "MacroSystem"
directory, and then restart NaturallySpeaking.


Usage:

Edit the file translations.txt and add additional phrases to be
converted.  Each line consists of a single word to be translated,
followed by a tab, followed by a translation which is intelligible
when passed to the text-to-speech engine.  Note that each time you modify
translations.txt, these changes are immediately reflected the next
time you say "read Clipboard", with no need to restart NaturallySpeaking.

Make sure you don't have another (NaturallySpeaking professional)
command installed named "read Clipboard".

Load some suitable text into the Clipboard (the contents of this
file would be fine for demonstration purposes) and say "read
Clipboard".

This version can also be invoked from the command-line, enabling
the user to run TTS manually from the keyboard.  For example, create
a Windows shortcut for this file and assign a keystroke combination
within that shortcut's Properties.  Then, for example, you can always
hear the contents of the Windows clipboard by striking Ctrl-Alt-F11.



Future ideas:


There are a lot of other interesting ideas which can be built upon
this simple program.  For example, one could take the output of Joel
Gould's GetWords program, process the pronunciations in some fashion,
and then provide these pronunciations as part of the input to this
program.

Based upon some simple rules, one could adjust the pitch and
speed of the text-to-speech engine to make the output more
intelligible and less monotonous.

It would be nice if there were a way to get accents placed on the
correct syllable.  For example, the word "zebrafish" should be pronounced
with its accent on the first syllable.  If you have figured out a way
to do this, please contact the author.


Author:

Jonathan Epstein (Jona...@nih.gov).  Please give proper
attribution if you redistribute the software in any manner.

Version 1.1, last modified December 18, 2002.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.




view recent posts