locked
widows powershell vs cscript vs vbscript, active on which windows versions ? RRS feed

  • Question

  • Hello & Thanks ,

    I need a script to text-to-speech from a file ,

    that will work on all windows from XP and up .

    Which of these script languages come standard with windows versions , from XP and up:

    widows powershell vs cscript vs vbscript .

    Thanks


    "All things in moderation, except for love and forgiveness."...vm

    Tuesday, December 13, 2016 5:53 PM

Answers

  • Read this

    https://learn-powershell.net/2013/12/04/give-powershell-a-voice-using-the-speechsynthesizer-class/

    • Marked as answer by vmars316 Tuesday, December 13, 2016 7:34 PM
    Tuesday, December 13, 2016 6:05 PM
  • Only "cscript" (vbscript/jscript" is available on all Windows versions including the defunct XP, WS2003 and WS2008.


    \_(ツ)_/

    • Marked as answer by vmars316 Tuesday, December 13, 2016 7:34 PM
    Tuesday, December 13, 2016 6:07 PM

All replies

  • Read this

    https://learn-powershell.net/2013/12/04/give-powershell-a-voice-using-the-speechsynthesizer-class/

    • Marked as answer by vmars316 Tuesday, December 13, 2016 7:34 PM
    Tuesday, December 13, 2016 6:05 PM
  • Only "cscript" (vbscript/jscript" is available on all Windows versions including the defunct XP, WS2003 and WS2008.


    \_(ツ)_/

    • Marked as answer by vmars316 Tuesday, December 13, 2016 7:34 PM
    Tuesday, December 13, 2016 6:07 PM
  • Hello & Thanks ,

    I need a cscript/vbs script to 

    speak a *.txt file .

    Thanks


    "All things in moderation, except for love and forgiveness."...vm

    • Merged by Bill_Stewart Wednesday, December 14, 2016 1:28 PM Duplicate
    Wednesday, December 14, 2016 12:35 AM
  • https://gallery.technet.microsoft.com/Out-Voice-1be16d5e

    Get-Content jabberwock.txt | Out-Voice


    \_(ツ)_/

    Wednesday, December 14, 2016 1:17 AM
  • Hello & Thanks ,
    I have a script .
    Could someone please show me 
    how to get input for this script below  FROM  a speakThis.txt file .

    set speech = Wscript.CreateObject("SAPI.spVoice") 
    speech.speak "hello"

    Thanks

    "All things in moderation, except for love and forgiveness."...vm

    • Merged by Bill_Stewart Monday, December 19, 2016 4:55 PM Duplicate
    Monday, December 19, 2016 4:47 PM
  • Duplicate. Please read the following:

    This forum is for scripting questions rather than script requests


    -- Bill Stewart [Bill_Stewart]

    Monday, December 19, 2016 5:01 PM
  • Bill_Stewart ,

    Hello & Thanks ,
    I have a script .
    Could someone please show me 
    how to get input for this script below  FROM  a speakThis.txt file .

    set speech = Wscript.CreateObject("SAPI.spVoice") 
    speech.speak "hello"

    I am not asking for a new script ,

    I am asking for help to correct an existing script .Thanks


    "All things in moderation, except for love and forgiveness."...vm

    Monday, December 19, 2016 10:39 PM
  • You are asking for how to read text from a text file using VBScript. There are numerous examples of how to do this. A quick search should provide enough information to help you get started with this task.

    Aside from all of this, you really should use PowerShell rather than VBScript.


    -- Bill Stewart [Bill_Stewart]

    Monday, December 19, 2016 10:49 PM
  • Bill_Stewart ,
    I really don't know what is your reluctance to help me .

    What I really, really, really, want to know is

    given this *.vbs :

    set speech = Wscript.CreateObject("SAPI.spVoice")
    speech.speak "hello"

    How can I get it to 'instead' , to read "hello" in from a *.txt file ?

    I have Googled all over the internet , stackexchange , etc..  
    They are all 'how to read into a variable ' or something other than what I need .

    Pls, What is the syntax for input into the 'speech.speak' command ? :
    speech.speak C:\hello.txt  

    If you don't know , please say so .
    Then I'll look else where .

    Thanks


    "All things in moderation, except for love and forgiveness."...vm

    Tuesday, December 20, 2016 12:23 AM
  • Bill ,

    The reason I want to do it in cscript is

    because I will call this script from 
    a program that needs to be able to 
    run on windows xp thru win10 , or at least winVista thru win10 .

    Thanks


    "All things in moderation, except for love and forgiveness."...vm

    Tuesday, December 20, 2016 12:36 AM
  • You need to learn how to write a script.  We do not write scripts on request.  Just because you copied a couple of lines does not excuse you.

    You can learn how to write scripts here: https://technet.microsoft.com/en-us/scriptcenter/dd772284.aspx

    The section on files will help.

    Since VBScript is pretty much obsolete it will become progrssively harder to find help on the Internet.  YOu should be learning PowerShell.

    #powershell
    $sapi = New-Object -ComObject SAPI.spVoice
    $words = cat test.txt|Out-String
    $sapi.Speak($words)


    \_(ツ)_/


    • Edited by jrv Tuesday, December 20, 2016 12:40 AM
    Tuesday, December 20, 2016 12:40 AM
  • PowerShell runs on all versions of Windows.


    \_(ツ)_/

    Tuesday, December 20, 2016 12:41 AM
  • They are all 'how to read into a variable ' or something other than what I need .

    This forum is designed to answer scripting questions. I already posted an answer for you: I provided a link with a sample query you can use to find out how to read from a text file using the FileSystemObject object in VBScript.

    If you don't understand the instructions, you need to take a step back and start learning the basics. That is to say, you have to understand basic arithmetic before you can start doing algebra. The same principle applies.

    Aside from this, as already noted, you really should start learning PowerShell rather than trying to use VBScript. There are lots of free resources available on the Internet to help you.


    -- Bill Stewart [Bill_Stewart]

    Tuesday, December 20, 2016 2:23 PM
  • jrv (Partner) ,
    Thanks : 
    The site you mentioned 
    https://technet.microsoft.com/en-us/scriptcenter/dd772284.aspx
    seems to be all about wscript and vbs script .
    I am also reaading :
    https://msdn.microsoft.com/en-us/powershell/scripting/core-powershell/ise/introducing-the-windows-powershell-ise
    https://msdn.microsoft.com/en-us/powershell/scripting/core-powershell/ise/how-to-write-and-run-scripts-in-the-windows-powershell-ise


    Anyways , I took your script:

    #powershell
    $sapi = New-Object -ComObject SAPI.spVoice
    $words = cat C:\batch_.bat_Scripts\test.txt|Out-String
    $sapi.Speak($words)

    I googled powershell file type , and got *.ps1 .
    Then put script into a file called: powerShell-TTS.ps1 , powerShell-TTS.ps2 , powerShell-TTS.ps3 .  
    DoubleClicked on file in winExplorer.

    For 'powerShell-TTS.ps1' Instead of running the script , win opened up the script in notepad.exe 
    For 'powerShell-TTS.ps2' up comes popup "How do you want to open this file" with no powerShell option . 
    For 'powerShell-TTS.ps3' up comes popup "How do you want to open this file" with no powerShell option . 
    When I use powershell_ise.exe . And paste your script into it .
    Al works fine . Very simple script :-)

    See , that's the type of thing I am trying to avoid .
    I want the 'xp -> win10' user to 'not be forced to' download/install anything new ,
    other than the script I present . 
    Does powerShell come standard with 'xp -> win10' ? 

    Btw: I haven't gotten that far yet in my reading , but
    "How do I start a powerShell script" ? 
    Ie., how can I run script with just a double-Click  .

    THanks

    "All things in moderation, except for love and forgiveness."...vm

    Tuesday, December 20, 2016 6:01 PM
  • Yu are asking incremental questions about how to write a script.  I recommend that you take the time to learn from the posted references.  You can also just search and find hundreds of examples and blogs showing you how to use a script.

    The forum is for technicians who use scripting professionally and not really about reaching home users how to use Windows or scripts.  The learning materials are extensive and free.  You can also search for many utilities that will do what you are asking.


    \_(ツ)_/

    Tuesday, December 20, 2016 6:50 PM
  • jrv ,

    Yes , I understand .
    Having to put my project on hold 
    to learn a new scripting language at the moment 
    is not do-able . 

    Here is a preview of what I am working on .
     http://vmars.us/freeware/pimClip/pimCLip-Help.html 

    The pimCLip part is done , except for the script that I need .
    The pimFind part is almost done , except for the Docs .

    Anyways , 'Wishing you all , the best for this Christmas Season' .

    Thanks


    "All things in moderation, except for love and forgiveness."...vm



    • Edited by vmars316 Tuesday, December 20, 2016 9:16 PM
    Tuesday, December 20, 2016 9:14 PM