Making PC's Speak with SAPI.SpVoice

Author Message
X BiLe

  • Total Posts : 45
  • Scores: 2
  • Reward points : 0
  • Joined: 6/18/2008
  • Location: Des Moines, IA
  • Status: offline
Making PC's Speak with SAPI.SpVoice Saturday, August 02, 2008 6:38 PM (permalink)
0
Not a useful script, but a little fun never the less. 

this is a few examples of usage for the SAPI.SpVoice Object (microsoft sam)

How to Make Your PC talk. (Talk Box Basic)

 '************************
 '* X BiLe
 '* Local Talk Box
 '* Solo VBS
 '************************
 
 do
 
   'create the voice object
   Set VObj = CreateObject("SAPI.SpVoice")
 
   'get what the user wants to say, exit if cancel or return no msg
   MSG = InputBox("Type what you want the PC to say" & VBCRLF & VBCRLF & VBCRLF & "To End enter Nothing or push the Cancel button", "Voice Box By X BiLe", "")
     If MSG = "" Then WScript.quit: Else
 
       'use the VObj to speak msg
       with VObj
         .Volume = 100
         .Speak MSG
       end with
 
 loop
 


Now the question is further posed on how to actually get someone elses pc to talk using remote access.

this challenge can easily be tackled assuming you have C$ access (C Share)

Please also note that this is not the only way to do this like all things in computers, please remember that in all scripts you do

 '************************
 '* X BiLe
 '* Remote Voice Send
 '* Solo VBS
 '************************
 
 'get ip
 IP = InputBox("Type the Name or IP of the PC to send Voice to:", "Remote Voice Send By X BiLe", "")
   If IP = "" Then WScript.quit: Else
 
 'get MSG
 MSG = InputBox("Type what you want the PC to say:", "Remote Voice Send By X BiLe", "")
   If MSG = "" Then WScript.quit: Else
 
 'vbs command to send
 A = "on error resume next" & VBCRLF & _
   "    CreateObject(""SAPI.SpVoice"").speak " & """" & MSG & """" & VBCRLF & _
   "    CreateObject(""Scripting.FileSystemObject"").DeleteFile (""C:\Voice1.vbs"")"
 
 ' Create the vbs on remote C$
 CreateObject("Scripting.FileSystemObject").OpenTextFile("\\" & ip & "\C$\Voice1.vbs",2,True).Write A
 
 ' Run the VBS through Wscript on remote machine via WMI Object Win32_Process
 B = GetObject("winmgmts:\\" & IP & "\root\cimv2:Win32_Process").Create("C:\windows\system32\wscript.exe ""C:\Voice1.vbs""", null, null, intProcessID)
 
 


like all objects to be created in VBS there are more than just the 3 properties i actually use here.

SAPI.SpVoice Properties:

'.Pause = pause speaking
'.resume = resume after pause
'.Rate = speed at which voice speaks
'.Voice = you can use set and a voice value to change the voice (if multiple exist on machine)
'.Volume = volume of voice (not system volume, just voice)
'.WaitUntilDone = wait until done - dont know how else to say that ;)


how to set the 3 useful voice Properties

 'create object and then setup the properties
 Set VObj = CreateObject("SAPI.SpVoice")
   with VObj
       Set .voice = .getvoices.item(0)
       .Volume = 100
       .Rate = 3
   end with
 


Please notice that the '.getvoices.item(0)' has refrenced item 0, the getvoices is in an array (if multiple are present)

to retrive the names of the values you could do a simple call like:

 'create object and then loop for the index and name
 Set VObj = CreateObject("SAPI.SpVoice")
   For Each Voice In VObj.getvoices
       I = I + 1
       msgbox "" & (I - 1) & " - " & Voice.GetDescription
   Next
 

i dont know, its just one of those toy codes any ways
<message edited by X BiLe on Saturday, August 02, 2008 6:46 PM>
 
#1
    AMBience

    • Total Posts : 31
    • Scores: 0
    • Reward points : 0
    • Joined: 7/24/2008
    • Status: offline
    RE: Making PC's Speak with SAPI.SpVoice Friday, August 08, 2008 2:32 AM (permalink)
    0
    This is very cool!
     
    I've made a few TTS scripts myself (to make sound FX not speech), but I only have SAM and he's a bit limited. 
     
    However, you can actually change the pitch of SAM as well as rate.  This is so hidden and undocumented and also very odd. There's no DOM like commands for pitch, instead you add it into the text he speaks using XML(?).   (Could somebody explain why this is so?)
     
    MyVoice.Speak "<pitch middle='25'>" &  "Hello" ,1 
     
    Pitch has a range of -25 to 25
     
    Have fun!
     
     
    #2
      cheater2478

      • Total Posts : 12
      • Scores: 0
      • Reward points : 0
      • Joined: 10/17/2008
      • Location: WPB , FL
      • Status: offline
      RE: Making PC's Speak with SAPI.SpVoice Friday, October 17, 2008 2:55 PM (permalink)
      0
      I love this script. Funny reactions from many people. Especially while in school. I tinkered with it and accidentally created a virus. Lol, I ended up making multiple viruses, but erased all evidence of existence....I hope.

       
      #3
        blksith0

        • Total Posts : 51
        • Scores: 0
        • Reward points : 0
        • Joined: 10/17/2008
        • Status: offline
        RE: Making PC's Speak with SAPI.SpVoice Saturday, October 18, 2008 2:38 AM (permalink)
        0
        So if you want to do it to someone elses computer, all you have to do is have their IP and just type it on the script?
         
        #4
          cheater2478

          • Total Posts : 12
          • Scores: 0
          • Reward points : 0
          • Joined: 10/17/2008
          • Location: WPB , FL
          • Status: offline
          RE: Making PC's Speak with SAPI.SpVoice Saturday, October 18, 2008 4:12 AM (permalink)
          0
          yea, but its hard to find someones ip out. I think.
           
          #5
            blksith0

            • Total Posts : 51
            • Scores: 0
            • Reward points : 0
            • Joined: 10/17/2008
            • Status: offline
            RE: Making PC's Speak with SAPI.SpVoice Saturday, October 18, 2008 4:32 AM (permalink)
            0
            So would this be right? Like is that where Im supposed to put the persons IP?

            '************************
            '* X BiLe
            '* Remote Voice Send
            '* Solo VBS
            '************************

            'get ip
            IP = InputBox("111.11.11.111:", "Remote Voice Send By X BiLe", "")
             If IP = "" Then WScript.quit: Else

            'get MSG
            MSG = InputBox("HELLO!:", "Remote Voice Send By X BiLe", "")
             If MSG = "" Then WScript.quit: Else

            'vbs command to send
            A = "on error resume next" & VBCRLF & _
             "    CreateObject(""SAPI.SpVoice"").speak " & """" & MSG & """" & VBCRLF & _
             "    CreateObject(""Scripting.FileSystemObject"").DeleteFile (""C:\Voice1.vbs"")"

            ' Create the vbs on remote C$
            CreateObject("Scripting.FileSystemObject").OpenTextFile("\\" & ip & "\C$\Voice1.vbs",2,True).Write A

            ' Run the VBS through Wscript on remote machine via WMI Object Win32_Process
            B = GetObject("winmgmts:\\" & IP & "\root\cimv2:Win32_Process").Create("C:\windows\system32\wscript.exe ""C:\Voice1.vbs""", null, null, intProcessID)

            And it will say hello on their computer right? Will a window come up or something, or will it just be like out of nowhere?
             
            #6
              cheater2478

              • Total Posts : 12
              • Scores: 0
              • Reward points : 0
              • Joined: 10/17/2008
              • Location: WPB , FL
              • Status: offline
              RE: Making PC's Speak with SAPI.SpVoice Saturday, October 18, 2008 5:30 AM (permalink)
              0
              no, now it shows that, change it back to the original, run it, enter the ip, press enter, enter the message, press enter, and ur done!
               
              #7
                blksith0

                • Total Posts : 51
                • Scores: 0
                • Reward points : 0
                • Joined: 10/17/2008
                • Status: offline
                RE: Making PC's Speak with SAPI.SpVoice Sunday, October 19, 2008 8:40 AM (permalink)
                0
                And will the noise just happen or will a window of the microsoft sam thing pop-up? Does it work from an XP to a vista?

                I tried it and I got this Error

                <message edited by blksith0 on Sunday, October 19, 2008 11:06 AM>
                 
                #8
                  mbouchard

                  • Total Posts : 2110
                  • Scores: 29
                  • Reward points : 0
                  • Joined: 5/15/2003
                  • Location: USA
                  • Status: offline
                  RE: Making PC's Speak with SAPI.SpVoice Sunday, October 19, 2008 11:47 PM (permalink)
                  0
                  Taking a look at the code you posted above, so I may be wrong on which line 21 is in your code, but:

                  CreateObject("Scripting.FileSystemObject").OpenTextFile("\\" & ip & "\C$\Voice1.vbs",2,True).Write A

                  This appears to be the issue, the script is not seeing the patch here. Do a wscript.echo "\\" & ip & "\C$\"

                  And make sure the path is correct.
                  Mike

                  For useful Scripting links see the Read Me First stickey!

                  Always remember Search is your friend.
                   
                  #9
                    blksith0

                    • Total Posts : 51
                    • Scores: 0
                    • Reward points : 0
                    • Joined: 10/17/2008
                    • Status: offline
                    RE: Making PC's Speak with SAPI.SpVoice Monday, October 20, 2008 11:51 AM (permalink)
                    0
                    Uh.. where do I put that? On line 21?
                     
                    #10
                      blksith0

                      • Total Posts : 51
                      • Scores: 0
                      • Reward points : 0
                      • Joined: 10/17/2008
                      • Status: offline
                      RE: Making PC's Speak with SAPI.SpVoice Monday, November 03, 2008 2:01 AM (permalink)
                      0
                      halp me. 
                       
                      #11
                        pcgeek86

                        • Total Posts : 10
                        • Scores: 0
                        • Reward points : 0
                        • Joined: 11/17/2008
                        • Status: offline
                        RE: Making PC's Speak with SAPI.SpVoice Thursday, November 20, 2008 2:52 AM (permalink)
                        0
                        How about some Powershell love? :)

                        [Reflection.Assembly]::LoadWithPartialName("System.Speech")
                        $voice = New-Object System.Speech.Synthesis.SpeechSynthesizer
                        $voice.Speak("Hello world")

                        Trevor Sullivan
                        Systems Engineer
                         
                        #12
                          munnadme

                          • Total Posts : 22
                          • Scores: 0
                          • Reward points : 0
                          • Joined: 2/26/2009
                          • Status: offline
                          RE: Making PC's Speak with SAPI.SpVoice Tuesday, May 05, 2009 4:03 AM (permalink)
                          0
                          Yoooo, this is really a cool script...    I liked it.... :-)  
                           

                           
                          #13
                            Amida

                            • Total Posts : 30
                            • Scores: 0
                            • Reward points : 0
                            • Joined: 5/31/2009
                            • Location: Codoria
                            • Status: offline
                            RE: Making PC's Speak with SAPI.SpVoice Thursday, June 04, 2009 2:56 AM (permalink)
                            0
                            That is fun to mess with I need this, I need.
                            Thank you for giving it to me.
                             
                            #14
                              komok

                              • Total Posts : 1
                              • Scores: 0
                              • Reward points : 0
                              • Joined: 8/9/2011
                              • Status: offline
                              RE: Making PC's Speak with SAPI.SpVoice Tuesday, August 09, 2011 7:50 AM (permalink)
                              0
                              My script speaks the text that is currently in your clipboard. It should be named speak.vbs to work correctly. How do you find it?  
                              'The speak.vbs script says aloud the text from the clipboard using the installed in system voice engine. By komokdj@yahoo.com 
                              Dim strComputer, strProcessKill, strText, strLocalTime, strMaxLocalTime 
                              Dim objWMIService, objProcess, colToKill, objVoice, objHTML 
                              'check whether the script is already running and terminate it if so
                              strComputer = "." 
                              strProcessKill = "speak.vbs" 
                              Set objWMIService = GetObject("winmgmts:" _ 
                              & "{impersonationLevel=impersonate}!\\" _ 
                              & strComputer & "\root\cimv2") 
                              Set colToKill = objWMIService.ExecQuery _ 
                              ("SELECT * FROM Win32_Process WHERE CommandLine LIKE '%" & strProcessKill & "%'")  
                              If colToKill.Count > 1 Then 
                              strMaxLocalTime = "" 
                              For Each objProcess In colToKill 
                              strLocalTime = Left(objProcess.CreationDate,14) 
                              If strLocalTime > strMaxLocalTime Then strMaxLocalTime = strLocalTime  
                              Next 
                              For Each objProcess In colToKill 
                              strLocalTime = Left(objProcess.CreationDate,14) 
                              If strLocalTime <> strMaxLocalTime Then objProcess.Terminate()  
                              Next 
                              End If 
                              'then speak the text 
                              Set objVoice = CreateObject("Sapi.SpVoice") 
                              Set objHTML = CreateObject("htmlfile") 
                              strText = objHTML.ParentWindow.ClipboardData.GetData("text") 
                              If strText <> "" Then objVoice.speak strText 
                              

                              <message edited by komok on Tuesday, August 09, 2011 9:53 AM>
                               
                              #15
                                StarWarsMG

                                • Total Posts : 9
                                • Scores: 0
                                • Reward points : 0
                                • Joined: 8/17/2011
                                • Location: Minnesota
                                • Status: offline
                                RE: Making PC's Speak with SAPI.SpVoice Wednesday, August 17, 2011 2:46 AM (permalink)
                                0
                                I love that script!

                                It's fun to trick my friends that are not computer geeks and making them think the computer is really talking.

                                Here is one of my favorite scripts
                                 
                                  
                                set wshshell = wscript.CreateObject("wscript.shell") 
                                 wshshell.run "Notepad" 
                                 wscript.sleep 2000 
                                 wshshell.AppActivate "Notepad" 
                                 WshShell.SendKeys "G" 
                                 WScript.Sleep 500 
                                 WshShell.SendKeys "H" 
                                 WScript.Sleep 500 
                                 WshShell.SendKeys "O" 
                                 WScript.Sleep 500 
                                 WshShell.SendKeys "S" 
                                 WScript.Sleep 500 
                                 WshShell.SendKeys "T" 
                                 WScript.Sleep 500 






                                <message edited by StarWarsMG on Wednesday, August 17, 2011 2:49 AM>


                                ~StarWarsMG
                                 
                                #16

                                  Online Bookmarks Sharing: Share/Bookmark

                                  Jump to:

                                  Current active users

                                  There are 0 members and 2 guests.

                                  Icon Legend and Permission

                                  • New Messages
                                  • No New Messages
                                  • Hot Topic w/ New Messages
                                  • Hot Topic w/o New Messages
                                  • Locked w/ New Messages
                                  • Locked w/o New Messages
                                  • Read Message
                                  • Post New Thread
                                  • Reply to message
                                  • Post New Poll
                                  • Submit Vote
                                  • Post reward post
                                  • Delete my own posts
                                  • Delete my own threads
                                  • Rate post

                                  2000-2012 ASPPlayground.NET Forum Version 3.9