Sign in to follow this  
Followers 0
James

ClipTalk

40 posts in this topic

#1 ·  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

Share this post


Link to post
Share on other sites

#2 ·  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

Share this post


Link to post
Share on other sites

#4 ·  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

Share this post


Link to post
Share on other sites

#5 ·  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

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

you're not looking for SAPI Functions, but methods

the speech api returns an object..

This object exposes it's methods (you can see this by using primalscript or vb IDE)

read this article from the M$ scripting guys...

http://www.microsoft.com/technet/scriptcen...games/sapi.mspx

Edited by lordofthestrings

Share this post


Link to post
Share on other sites

#11 ·  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[center] VW Bug user[/center]Pinheiral (Pinewood) city: http://pt.wikipedia.org/wiki/Pinheiral

Share this post


Link to post
Share on other sites

Thanks Percy!

Yeah, thanks Percy!

I can do signature me.

Share this post


Link to post
Share on other sites

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

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

Thankyou. No-one will look further.

Cyber, you rock!

Thank you,

I just want to ask everyone to check out my new script: Protocol Managing


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

Lol, thats it Cyber, advertise your own project :rolleyes:

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

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0