~ voice script for current time ~

Discussion in 'Scripting' started by Dos_Probie, Sep 12, 2012.

  1. Dos_Probie

    Dos_Probie MDL Senior Member

    Jul 18, 2012
    250
    86
    10
    #1 Dos_Probie, Sep 12, 2012
    Last edited by a moderator: Apr 20, 2017
    Hey Everyone!
    Here's a voice vbs script that will speak current time..
    Copy and Paste to .txt file and rename to CurrentTime.vbs
    Sounds alright in W7 but even better in W8..
    enjoy... Dos_Probie :D

    Code:
    ' GetCurrentTime.vbs - Dos_Probie
    ' Add your voice txt here
    Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
    Sapi.speak "The current time is"
    'calculate time in 12hr format
    if hour(time) > 12 then
    Sapi.speak hour(time)-12
    else
    if hour(time) = 0 then
    Sapi.speak "12"
    else
    Sapi.speak hour(time)
    end if
    end if
    
    if minute(time) < 10 then
    Sapi.speak "o"
    if minute(time) < 1 then
    Sapi.speak "clock"
    else
    Sapi.speak minute(time)
    end if
    else
    Sapi.speak minute(time)
    end if
    if hour(time) > 12 then
    Sapi.speak "P.M."
    else
    if hour(time) = 0 then
    if minute(time) = 0 then
    Sapi.speak "Midnight"
    else
    Sapi.speak "A.M."
    end if
    else
    if hour(time) = 12 then
    if minute(time) = 0 then
    Sapi.speak "Noon"
    else
    Sapi.speak "P.M."
    end if
    else
    Sapi.speak "A.M."
    end if
    end if
    end if
     
  2. Dos_Probie

    Dos_Probie MDL Senior Member

    Jul 18, 2012
    250
    86
    10
    #2 Dos_Probie, Sep 13, 2012
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Don't follow..explain :confused: