Jump to content
Sign in to follow this  
Noviceatthis

Text to Speech (use of Clipboard)

Recommended Posts

Noviceatthis

I'm trying to write a script that reads text from the clipboard and then gets the computer to say it, here's what I have so far:

#include <Clipboard.au3>

$oldclip = ""

While 1
    Global $currentclip = _ClipBoard_GetData()
    If $currentclip = "0" Then
        Sleep(1000)
    ElseIf $currentclip = $oldclip Then
        Sleep(1000)
    Else
        speak()
    EndIf

    $oldclip = $currentclip
WEnd

Func speak()
    $voice = ObjCreate("SAPI.SpVoice")
    $voice.speak($currentclip)
EndFunc   ;==>speak

It works for single lines of text, but not for text including a paragraph, i.e.

"This works"

"But this

doesnt"

I was wondering whether there was a solution to this

Thanks in advance

 

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.