Welcome Features News Download Registration Support FAQ Wish list Links
Advanced stock charting and analysis program

A-Z Index | Category Index |

SAY
- speaks provided text

Miscellaneous functions
(AFL 2.90)


SYNTAX Say(''text'', purge = True)
RETURNS NUMBER
FUNCTION Say() function speaks user-specified text (Windows XP, on lower-end Windows you need to install Microsoft Speech API, voice settings are in Windows Control Panel)

New in 5.20 - 'purge' parameter

when purge is set to True (the default) - any call to Say() purges all previous speak requests (queued or in-progress) and speaks specified text immediatelly.

when purge is set to False - speak request is queued and will be spoken right after previous requests are done.

Also now Say() function returns the NUMERIC value that indicates how many speak requests are pending
0 - ERROR - speech engine not installed or not working properly
1 - currently requested text is spoken now (queue was empty)
2 or more - queue was not empty and previous request(s) will be completed prior to speaking currently specified text

EXAMPLE // simple example
Say("Testing text to speech engine");


// helpful helper functions

function SayOnce( text )
{
  
if( StaticVarGetText("lastsaidtext") != text )
   {
      
Say( text );
      
StaticVarSetText("lastsaidtext", text );
   }
}

function SayNotTooOften( text, Minperiod )
{
   elapsed=
GetPerformanceCounter()/1000;
   Lastelapsed =
Nz( StaticVarGet("lastsaytime") );

  
if( elapsed - Lastelapsed > Minperiod )
   {
    
StaticVarSet("lastsaytime", elapsed );
    
    
Say( text );
   }
  

}



SayOnce("Testing "+Name() );
SayNotTooOften(
"Say not more often than every 60 seconds", 60 );  

  
SEE ALSO

References:

The Say function is used in the following formulas in AFL on-line library:


 


About | Privacy | Terms of Use | Contact information
Copyright © 2003 AMIBROKER.COM