Jump to content

Recommended Posts

Posted

Hello!

Yes it gives a antoher way: ive maked it self

$sprache = ObjCreate("SAPI.SpVoice")
_Talk("My name is "&@UserName)
Func _Talk($text)
    $sprache.Speak($text)
EndFunc

www.AutoIt.de - Moderator of the German AutoIt Forum

 

  • Replies 72
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

Is there a way around the tempfile?

I'm having conflicts wanting to run the same talking script a few times in a very short time.

This way works too. You can do voice volume, speed, pitch, and different voices

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)
            TrayTip("Female Reader",$s_text,1)
        Case $s_voice == 2
            $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mike", "Language=409").Item(0)
            TrayTip("Male Reader",$s_text,1)
        Case $s_voice == 3
            $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Sam", "Language=409").Item(0)
            TrayTip("OldMan Reader",$s_text,1)
    EndSelect
    $o_speech.Speak ($s_text)
    $o_speech = ""
    Sleep(1000)
    TrayTip("","",1)
EndFunc ;==>_TalkOBJ
Check out ConsultingJoe.com
Posted

Download latest beta http://www.autoitscript.com/autoit3/files/beta/autoit/

and use Alt-F5 in scite to run

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Posted

well downloaded the latest beta an installed it successfully...then I reopen my script and press alt+f5...it break at the OBJCREATE function... What am I doing wrong?

Posted

well downloaded the latest beta an installed it successfully...then I reopen my script and press alt+f5...it break at the OBJCREATE function... What am I doing wrong?

Thats strange, run the Toggle AU3 Beta script in the start menu
Check out ConsultingJoe.com
Posted

Done, but still won't work....omg here is the code. It always hangs at line 53..the OBJCreate function

#include <GUIConstants.au3>
Opt("MouseCoordMode", 2)
Opt("PixelCoordMode", 2)

GUICreate("talk v1.0 by Tim koschützki",300,200,200,200)
GUICtrlCreateLabel("Text:",10,15,30,25)
$myedit=GUICtrlCreateInput("Ich liebe Dich, Maria Schnuggel Putzi!",40,15,250,20)
GUICtrlCreateLabel("Stimme:",10,55,30,25)
$femaleVoice=GUICtrlCreateRadio ("weiblich",50, 55, 70, 20)
$maleVoice=GUICtrlCreateRadio ("männlich",130, 55, 70, 20)
$oldVoice=GUICtrlCreateRadio ("opa",210, 55, 70, 20)
GUICtrlSetState ($femaleVoice,$GUI_CHECKED)
$speak=GUICtrlCreateButton("Speak!",60,120,60,25)
Global $katze1=GUICtrlCreatePic("katze.jpg",135,120,130,60)
Global $katze2=''

Global $voice=1

while 1
    GUISetState()
    $msg=GUIGetMsg()
    Select
        Case $msg=$femaleVoice
            $voice=1
        Case $msg=$maleVoice
            $voice=2
        Case $msg=$oldVoice
            $voice=3
        Case $msg=$speak
            _Talk(GUICtrlRead($myedit))
            $katze1=GUICtrlCreatePic("katze.jpg",135,120,130,60)
            GUICtrlDelete($katze2)
        Case $msg=$GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd
exit

Func _Talk($sText)
    $katze2=GUICtrlCreatePic("katze2.jpg",135,120,130,60)
    GUICtrlDelete($katze1)
    $tempFile = @TempDir & '\talktemp.vbs'
    FileWriteLine($tempFile, 'Dim Talk' & @CRLF & _
    'Set Talk = WScript.CreateObject("SAPI.SpVoice")' & _
    @CRLF & 'Talk.Speak "' & $sText & '"')
    RunWait('Wscript.exe talktemp.vbs', @TempDir)
    FileDelete($tempFile)
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)
            TrayTip("Female Reader",$s_text,1)
        Case $s_voice == 2
            $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mike", "Language=409").Item(0)
            TrayTip("Male Reader",$s_text,1)
        Case $s_voice == 3
            $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Sam", "Language=409").Item(0)
            TrayTip("OldMan Reader",$s_text,1)
    EndSelect
    $o_speech.Speak($s_text)
    $o_speech = ""
    Sleep(1000)
    TrayTip("","",1)
EndFunc
Posted

#include <guiconstants.au3>
Opt("WinTitleMatchMode",4)
$TaskPos=WinGetPos("classname=Shell_TrayWnd")

$ClipGUI = GUICreate("",200,200,@DesktopWidth-200,@DesktopHeight-201-$TaskPos[3],$WS_POPUPWINDOW, $WS_EX_TOPMOST)
$ClipTxt = GUICtrlCreateLabel("",0,0,200,200)

$talk = ObjCreate("SAPI.SpVoice")
Global $clip=ClipGet()

;#cs; Uncomment this line and the one below StopTalking() to be able to 'stop' the talking mid-sentence
While 1
    $Clip2 = ClipGet()
    If $Clip2 <> $Clip Then
        AdlibEnable("stopTalking")
        $Clip = $Clip2
        GUICtrlSetData($ClipTxt,$Clip)
        GUISetState(@SW_SHOW,$ClipGUI)
        $talk.Speak($Clip)
        GUISetState(@SW_HIDE,$ClipGUI)
    EndIf
WEnd

Func stopTalking()
    If GUIGetMsg() = $ClipTxt Then
        $talk.Speak(" ")
        GUISetState(@SW_HIDE,$ClipGUI)
    EndIf
EndFunc
;#ce; Uncomment this line and the one above the while loop to be able to 'stop' the talking mid-sentence

While 1;only runs if you comment out the above while loop-causes reading to be slow, but stoppable
    $Clip2 = ClipGet()
    If $Clip2 <> $Clip Then
        $Clip = $Clip2
        $ClipArray = StringSplit($Clip," ")
        GUICtrlSetData($ClipTxt,$Clip)
        GUISetState(@SW_SHOW,$ClipGUI)
        For $i=1 To $ClipArray[0]
            If GUIGetMsg() = $ClipTxt Then ExitLoop
            $talk.Speak($ClipArray[$i])
        Next
        GUISetState(@SW_HIDE,$ClipGUI)
    EndIf
WEnd
This script sits in your taskbar and waits for you to change the contents of the clipboard...so when you copy (and for some reason paste) text to the clipboard, it reads it to you and shows you the text near the notification area. The only problem is, I'd like to have it STOP reading if you click the pop-up text window. I tried this several ways in the adlib function, (the latest being reflected here-tell it to read nothing), but even if you just have a MsgBox function, it waits until it's done reading to process the adlib. It won't even process the tray icon for a pause command until it's done reading.

I can get it to work (without adlib) if I break the string apart by spaces (uncomment the two indicated lines to see this in action), but then it's reading each word individually - no sentence structure inflection or anything, and REALLY slow.

Does anybody know how to 'interrupt' the reading function - that is, keep it from grinding the script to an absolute stop while it's processing?

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Posted

Done, but still won't work....omg here is the code. It always hangs at line 53..the OBJCreate function

give this a try

download the latest beta

run the installer, when it prompts you for the installation path dont hit enter

it will say something like

c:\program files\autoit3\beta (or something like that)

just delete the \beta part

let the beta install over top of the org. release

i think what is happening is that you have the 3.11 release installed which doesnt support com.

and you have the beta release installed (in \beta) but when you click on a script, it's executed with 3.11 and not the beta.

so by doing what i said above, it will install the beta over top of 3.11 and when you click on a script, it will run with the beta.

you could also mod the file associations, but this way is just as easy.

Posted

Thanks that did it for me. :) Unfortunately I don't have all Microsoft voices...I reckon they are quite big...so it would not be very wise to supply them with the autoit program. :(

Posted (edited)

k downloaded all and works like a charm, very nice! :)

How can I use the api to alter the speed?

http://msdn.microsoft.com/library/default....TS_Tutorial.asp

usage examples:

$o_speech.Speak ("<rate speed='5'>" & $s_text & "</rate>")

OR

$o_speech.Speak ("<VOLUME LEVEL='quiet'>" & $s_text & "</VOLUME>")

OR

$o_speech.Speak ("<emph>" & $s_text & "</emph>")

Edited by zerocool60544
Check out ConsultingJoe.com
Posted

This way works too. You can do voice volume, speed, pitch, and different voices

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)
            TrayTip("Female Reader",$s_text,1)
        Case $s_voice == 2
            $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mike", "Language=409").Item(0)
            TrayTip("Male Reader",$s_text,1)
        Case $s_voice == 3
            $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Sam", "Language=409").Item(0)
            TrayTip("OldMan Reader",$s_text,1)
    EndSelect
    $o_speech.Speak ($s_text)
    $o_speech = ""
    Sleep(1000)
    TrayTip("","",1)
EndFunc;==>_TalkOBJ
Thanks zero, that's just what i needed!

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...