Jump to content

Recommended Posts

Posted (edited)

Hey,

Bored, and I couldn't be bothered to read a webpage so I decided I would make my computer do all the work.

#include <Misc.au3>

HotKeySet("^t", "_Talk")
HotKeySet("^e", "_Exit")
HotKeySet("^r", "_Stop")

Global $voice = ObjCreate("Sapi.SpVoice")
Local $Talk = 0

While 1
    Sleep(100)
WEnd

Func _Talk()
    $Clip = ClipGet()
    Do
        Speak($Clip, 0, 100)
        $Talk = 1
    Until $Talk = 1 Or _IsPressed(12) & _IsPressed(53)
EndFunc   ;==>_Talk

Func _Stop()
    $voice = ObjCreate("Sapi.SpVoice")
EndFunc

Func Speak($text, $Rate, $Volme)
    Local Const $SVSFlagsAsync = 1
    If IsObj($voice) Then
        $voice.Voice = $voice.GetVoices("Name=Microsoft Sam", "Language=409").Item(0)
        $voice.Rate = $Rate
        $voice.Volume = $Volme
        $voice.Speak ($text, $SVSFlagsAsync)
    EndIf
EndFunc   ;==>Speak

Func _Exit()
    Exit
EndFunc   ;==>_Exit

I cant make a stop function :rolleyes: but I did try.

Any comments/suggestions, welcome!

Thanks,

James

Edit: Thanks to Cyber for the stop function which he found and added :rambo:

Edited by Secure_ICT
Posted (edited)

I saw Lazyreader here a while ago..

it does the same thing.. interact with the speech application programming interface..

(the stop function Lazy reader uses is hotkeyset) (--edit -- but Now I see that you allready use it like this)

I hope this helps..

I love this API..

kind regards,

Edited by lordofthestrings
Posted (edited)

Secure_ICT,

Great minds think alike? Funny how we have the exact same idea although mine was more of a joke (ie, trying to make it appear to be this "amazing" piece of software when it really isn't).

Anyway, the only way I was able to get it to stop talking was by running the speech object in a separate script. Were you able find a different way of doing it?

zfisherdrums...

Edited by zfisherdrums
Posted (edited)

I made this also, I'm not sure if I posted it but here:

Just select text and Ctrl+` to speak.

HotKeySet( "^`", "speak" )

While 1
    Sleep(10)
WEnd

Func speak()
    Send("^c")
    _TalkOBJ( ClipGet(), 2 )
EndFunc

Func _TalkOBJ($s_text, $s_voice = 3)
    Local $quite = 0
    Local $o_speech = ObjCreate("SAPI.SpVoice")
    Select
        Case $s_voice == 0
            Return
        Case $s_voice == 1
            $o_speech.Voice = $o_speech.GetVoices ("Name=Microsoft Mary", "Language=409").Item (0);female
        Case $s_voice == 2
            $o_speech.Voice = $o_speech.GetVoices ("Name=Microsoft Mike", "Language=409").Item (0);male
        Case $s_voice == 3
            $o_speech.Voice = $o_speech.GetVoices ("Name=Microsoft Sam", "Language=409").Item (0);sam
    EndSelect
    $o_speech.Speak ($s_text)
    $o_speech = ""
    Sleep(1000)
    TrayTip("", "", 1)
EndFunc   ;==>_TalkOBJ

BTW: There is a way to stop it, I had it, try searching through the topics. someone told me once. I'll find it tomorrow if you don't

Edited by CyberZeroCool
Check out ConsultingJoe.com
Posted
  Secure_ICT said:

I will take a look at it, see if I can get it to stop reading.

Don't hope, I tried to find it for Talk2Me but nothing.

I can do signature me.

Posted (edited)

In my old UDF for manage MSAgent, I have a function _MAStop() that stop any action from char.

I think you can call anything like ".Stop" to do it

See MsAgentLib

Edited by A. Percy

Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator

VW Bug user

Pinheiral (Pinewood) city:

http://pt.wikipedia.org/wiki/Pinheiral

Posted

I Found it. I updated your script with it. Use Ctrl+r to stop

Topic on it is here: http://www.autoitscript.com/forum/index.ph...st&p=221119

to pause and resume use $speak.pause() and $speak.resume() but to stop just recreate the object itself.

to allow the script to continue while speaking you must use: $voice.Speak ($text, 1)

I hope this helps everyone.

#include <Misc.au3>

HotKeySet("^t", "_Talk")
HotKeySet("^e", "_Exit")
HotKeySet("^r", "_Stop")

Global $voice = ObjCreate("Sapi.SpVoice")
Local $Talk = 0

While 1
    Sleep(100)
WEnd

Func _Talk()
    $Clip = ClipGet()
    Do
        Speak($Clip, 0, 100)
        $Talk = 1
    Until $Talk = 1 Or _IsPressed(12) & _IsPressed(53)
EndFunc   ;==>_Talk

Func _Stop()
    $voice = ObjCreate("Sapi.SpVoice")
EndFunc

Func Speak($text, $Rate, $Volme)
    Local Const $SVSFlagsAsync = 1
    If IsObj($voice) Then
        $voice.Voice = $voice.GetVoices("Name=Microsoft Sam", "Language=409").Item(0)
        $voice.Rate = $Rate
        $voice.Volume = $Volme
        $voice.Speak ($text, $SVSFlagsAsync)
    EndIf
EndFunc   ;==>Speak

Func _Exit()
    Exit
EndFunc   ;==>_Exit
Check out ConsultingJoe.com
Posted (edited)
  CyberZeroCool said:

Thanks, I helped you, so I figured you wouldn't mind helping me. Thanks for the comment.

Because advertise in existing thread (where you helped with something) is better than making new thread to advertise your new phone, Secure. (where you aren't helped a bit) Edited by i542

I can do signature me.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...