IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VBScript Discussion :

Nombre de dossier, plus SAPI.SpVoice


Sujet :

VBScript

  1. #1
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2020
    Messages
    114
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Eure et Loir (Centre)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2020
    Messages : 114
    Points : 92
    Points
    92
    Par défaut Nombre de dossier, plus SAPI.SpVoice
    Bonjour à tous !

    j'ai un script qui est capable d'afficher le nombre de dossier de n'importe quel répertoire de windows.

    ma demande est donc. est il possible de passer ce script en (hta)

    et surtout de vocaliser le resultat au lieu de l'écrire.

    voici le code, le code est fonctionnel pour ceux que cela intéresse
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    '*** Definition des variables d'environnement
    Set fso = WScript.CreateObject("Scripting.FileSystemObject")
    Set objFolder = fSO.GetFolder("C:\Demonstration\Test")
     
    '*** Comptage du nombre de Plugin dans le répertoire
    CountSubfolders = objFolder.Subfolders.count
     
    '*** Affichage du résultat
    wscript.echo "Nombre de Plugin = " & CountSubfolders
    '*** Destruction des objets
    Set fso = Nothing
    Set objFolder = Nothing

  2. #2
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut

    Dans un HTA éviter surtout la création d'objets ou il y a wscriptExemple ceci Set fso = Wscript.CreateObject("Scripting.FileSystemObject") doit-être remplacé par Set fso = CreateObject("Scripting.FileSystemObject") et aussi le
    wscript.echo doit-être remplacé la par un MsgBox
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    '*** Definition des variables d'environnement
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set objFolder = fSO.GetFolder("E:\Test")
     
    '*** Comptage du nombre de Plugin dans le répertoire
    CountSubfolders = objFolder.Subfolders.count
     
    '*** Affichage du résultat
    CountSub = "Nombre de Plugin = " & CountSubfolders
    MsgBox CountSub
    SpeakIt(CountSub)
    '*** Destruction des objets
    Set fso = Nothing
    Set objFolder = Nothing 
     
    Sub SpeakIt(str)
        CreateObject("SAPI.SpVoice").Speak(str)
    End Sub

  3. #3
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2020
    Messages
    114
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Eure et Loir (Centre)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2020
    Messages : 114
    Points : 92
    Points
    92
    Par défaut Nombre de dossier
    Bonjour et Merci Hackoofr de votre réponse.

    votre script fonctionne je confirme

    mais pourquoi le (hta)
    parce que j'aurais été sur qu'il vocalise le résultats en français. sauf que la il est anglais hélas.
    donc pas bon pour moi

  4. #4
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut
    Citation Envoyé par Angelus1753 Voir le message
    parce que j'aurais été sur qu'il vocalise le résulta en français. sauf que la il est anglais hélas. donc pas bon pour moi
    Tester ce vbscript pour voir si la voix française est-elle bien installé ou non ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    Option Explicit
    Dim msg, sapi ,Voice,i
    Set sapi = createObject("sapi.spvoice")
    Set sapi.Voice = sapi.GetVoices.Item(Lang)
    sapi.Speak "Bonjour"
    For each Voice in Sapi.GetVoices
        i= i + 1
        MsgBox "Index = "& (i - 1) & " - " & Voice.GetDescription
    Next
    '----------------------------------------------------------------------------------------------------------------
    Function Lang()
    If Oslang = 1036 Then 
        Lang = 0 
    Else
        Lang = 1
    End If
    End Function
    '----------------------------------------------------------------------------------------------------------------
    Function OSLang()
        Dim dtmConvertedDate,strComputer,objWMIService,oss,os
        Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
        strComputer = "."
        Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
        Set oss = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
        For Each os in oss
            OSLang = os.OSLanguage
        Next
    End Function
    '----------------------------------------------------------------------------------------------------------------

  5. #5
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2020
    Messages
    114
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Eure et Loir (Centre)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2020
    Messages : 114
    Points : 92
    Points
    92
    Par défaut Nombre de dossier
    voix française installé la voix sapi de virginie

    Os Windows 7 64

    fonctionne très bien avec votre script d'éxpiration de programme voix en français avec le (hta)

    j'ai tésté le script

    une nouvelle fois non. voix anglaise...

  6. #6
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut
    Pouvez-vous poster le code complet de votre HTA ? Nombre_Dossier.hta

  7. #7
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2020
    Messages
    114
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Eure et Loir (Centre)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2020
    Messages : 114
    Points : 92
    Points
    92
    Par défaut
    le code ( hta ) c'est le votre il fonctionne à merveille

    il ne compte pas les dossier. mais il donne l'expiration je m'en sert comme rappelle.

    la voix et bien en français avec ce code HTA

    Code HTML : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    <html>
    <head>
    <TITLE>Expiration_Date</TITLE>  
    <HTA:APPLICATION  
    APPLICATIONNAME="Expiration_Date"  
    VERSION="1.0.0.0"  
    BORDER="none"  
    INNERBORDER="no"  
    CAPTION="no"  
    MAXIMIZEBUTTON="no"  
    MINIMIZEBUTTON="no"  
    ICON="NO"  
    SCROLL="no"  
    SCROLLFLAT="yes"  
    SINGLEINSTANCE="yes"  
    WINDOWSTATE="normal"  
    SHOWINTASKBAR="no"  
    CONTEXTMENU="Yes" 
    SYSMENU="Yes" 
    SELECTION="no"/>
    </head>
    <BODY BGCOLOR="#000000" TOPMARGIN="0" LEFTMARGIN="0">
    <center><TABLE WIDTH="200" BORDER="1" BORDERCOLOR="#000000" BGCOLOR="#BBBBFF" CELLPADDING="2" CELLSPACING="1">
    <TR BGCOLOR="#346E99"><TD COLSPAN="2"><CENTER><FONT COLOR="#FFFFFF" SIZE="+1" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">-= T I M E R =-</FONT></CENTER></TD></TR>
    <TR><TD WIDTH="150"><center><TEXT>Temps Restant</TEXT></center></TD><TD WIDTH="150"><center><SPAN ID="temps"></SPAN></center></TD></TR></TABLE>
    <br><br>
    <div id="bl" style="visibility:hidden"><font size="+2" color="red"><center>ATTENTION Le Controle Technique de ta voiture est expirer !!!</center></font></div>
    </body>
    </html>
    <SCRIPT Language="VBScript">
    Option Explicit
    Dim HRS,MIN,SEC,IdTimer,temps
    SEC ="0"
    MIN ="0"
    HRS ="0"
    '-----------------------------------------------------------
    Sub CenterWindow(x,y)
        Dim iLeft,itop 
        window.resizeTo x,y
        iLeft = window.screen.availWidth/2 - x/2
        itop = window.screen.availHeight/2 - y/2
        window.moveTo ileft, itop
    End Sub
    '-----------------------------------------------------------
    Sub Window_onLoad
        CenterWindow 500,200
        Expiration_Date()
    End Sub 
    '-----------------------------------------------------------
    Sub Expiration_Date()
        Dim Expiration,DateSysteme,IdTimer,Diff
        Expiration = Cdate("17/08/2050")
        DateSysteme = Date 
        Diff = (DateSysteme - Expiration)
        If (DateSysteme < Expiration) Then
            Call Parler("Le Controle Technique de la lagouna est encore valide ! Il te reste encore "& Abs(Diff) &" Jours !")
            bl.InnerHTML = "<font size=""+2"" color=""green"">Le Controle Technique de ta voiture est encore valide !!!<br>Il vous reste encore "& Abs(Diff) &" Jours !</font>"
            IdTimer=Window.SetInterval("blink(bl)",500)
            Call TIMER
        Else
            Call Parler("Le Controle Technique de ta voiture est expirer!")
            IdTimer=Window.SetInterval("blink(bl)",500)
            Call Timer
        End If
    End Sub
    '-----------------------------------------------------------
    SUB TIMER()
        Set temps = Document.getElementById("temps")
        IF SEC <> "59" Then
            SEC=SEC+1
            If SEC = "11" Then Window.Close
        ELSE
            SEC = "0"
            IF MIN <> "59" THEN
                MIN = MIN+1
            ELSE
                MIN = "0"
                HRS = HRS+1
            END IF
        END IF
        IF LEN(SEC)="1" THEN SEC="0"&SEC
        IF LEN(MIN)="1" THEN MIN="0"&MIN
        IF LEN(HRS)="1" THEN HRS="0"&HRS
        temps.InnerHTML = "<TEXT>"&HRS&":"&MIN&":"&SEC&"</TEXT>"
        Window.ClearTimeOut(IdTimer)
        IdTimer=Window.SetTimeOut("TIMER()",1000,"VBScript")
    END SUB
    '-----------------------------------------------------------
    Function blink(Obj)
        if Obj.style.visibility = "visible" Then
            Obj.style.visibility = "hidden"
        else
            Obj.style.visibility = "visible"
        end if
    End Function
    '-----------------------------------------------------------
    Sub Parler(msg)
        Dim ws,fso,f,TempName,TempFile,TempFolder
        Set ws = CreateObject("wscript.Shell")
        Set fso = CreateObject("Scripting.FileSystemObject")
        Tempname = fso.GetTempName
        TempFolder = WS.ExpandEnvironmentStrings("%Temp%")
        TempFile = TempFolder & "\" & Tempname & ".vbs"
        Set f = fso.OpenTextFile(Tempfile,2,True)
        f.Writeline    "CreateObject(""SAPI.SpVoice"").Speak "& chr(34) & msg & chr(34) &""
        ws.run Tempfile
    End Sub
    '-----------------------------------------------------------
    </script>

  8. #8
    Modérateur
    Avatar de l_autodidacte
    Homme Profil pro
    Retraité : Directeur de lycée/Professeur de sciences physiques
    Inscrit en
    Juillet 2009
    Messages
    2 415
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 68
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Retraité : Directeur de lycée/Professeur de sciences physiques
    Secteur : Enseignement

    Informations forums :
    Inscription : Juillet 2009
    Messages : 2 415
    Points : 5 806
    Points
    5 806
    Par défaut
    Il faut paramétrer la voix à partir du panneau de configuration :
    Fais un double-clic sur Voix pour ouvrir la fenêtre Propriétés de la reconnaissance vocale puis choisis la voix voulue.
    Ne pas oublier le tag si satisfait.
    Voter pour toute réponse satisfaisante avec pour encourager les intervenants.
    Balises CODE indispensables. Regardez ICI
    Toujours utiliser la clause Option Explicit(VBx, VBS ou VBA) et Ne jamais typer variables et/ou fonctions en VBS.
    Vous pouvez consulter mes contributions
    Ne pas oublier de consulter les différentes FAQs et les Cours/Tutoriels VB6/VBScript
    Ne pas oublier L'Aide VBScript et MSDN VB6 Fr

  9. #9
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2020
    Messages
    114
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Eure et Loir (Centre)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2020
    Messages : 114
    Points : 92
    Points
    92
    Par défaut
    Bonsoir l_autodidacte.

    Malheureusement je l'ai déjà fait et rien y fait.

    Si on prend un script en vbs la voix est en anglais. Si on prend un script en ( hta ) la voix est en français . Pourquoi aucune idée.

  10. #10
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut

    Code HTML : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    <html>
    <head>
    <meta charset="utf-8" />
    <META HTTP-EQUIV="MSThemeCompatible" CONTENT="YES">
    <title>Get and Speaking Voices</title>
    <HTA:APPLICATION 
        APPLICATIONNAME="Get and Speaking Voices"
        SCROLL="no"
        SINGLEINSTANCE="yes"
        icon="narrator.exe"
        INNERBORDER="NO"
        MAXIMIZEBUTTON="NO"
        MINIMIZEBUTTON="YES"
    >
    <style type="text/css">
      body {
            font-family:Verdana;
            font-size: 10x;
            color: #49403B;
            background: LightGreen;
    }
    </style>
    </head>
    <script language="VBScript">
    Option Explicit
    Dim objOption,sapi
    Set sapi = createObject("sapi.spvoice")
    '----------------------------------------------------------------------------------------------------------------
    Sub CenterWindow( widthX, heightY )
        self.ResizeTo widthX, heightY 
        self.MoveTo (screen.Width - widthX)/2, (screen.Height - heightY)/2
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    Sub Window_OnLoad()
        CenterWindow 700,350
        Call getVoices()
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    Sub getVoices()
        Dim msg,Voices,Voice,i
        Set sapi = createObject("sapi.spvoice")
        set Voices = sapi.GetVoices
        ClearListbox
        OptVoices.style.backgroundcolor = "#13eac9"
        For each Voice in Voices
            i = i + 1
            Set objOption = Document.createElement("OPTION")
            objOption.Text = Voice.GetDescription & " - Index = "& (i - 1) & ""
            objOption.Value = i - 1
            OptVoices.Add(objOption)
        Next
    End sub
    '----------------------------------------------------------------------------------------------------------------
    Sub ClearListbox()
        For Each objOption in OptVoices.Options
            objOption.RemoveNode
        Next 
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    Sub SpeakIt(str)
        Dim msg, Voices
        set Voices = sapi.GetVoices
        Set sapi.Voice = Voices.Item(OptVoices.Value) 
        sapi.Speak str,1
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    Sub PauseSpeak()
        sapi.pause()
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    Sub ResumeSpeak()
        sapi.Resume()
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    Sub StopSpeak()
       call sapi.Skip("Sentence","10")
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    </script>
    <body>
    <center>
    <p><textarea id="msg" cols="70" rows="12">
    Si on prend un script en vbs la voix est en anglais. Si on prend un script en ( hta ) la voix est en français . Pourquoi? aucune idée?
     
    If we take a script in vbs the voice is in English. If we take a script in (hta) the voice is in French. Why? no idea?
    </textarea></p>
    <input type="button" id ="BtnVoices" value="Lire avec la voix" onClick="Call SpeakIT(msg.Value)" style="cursor:hand;">
    <select size="1" name="OptVoices" style="Width:370px;"></select>
    <br><br>
    <input type="button" value="Pause" onClick="PauseSpeak" style="cursor:hand;">
    <input type="button" value="Reprendre la lecture" onClick="ResumeSpeak" style="cursor:hand;">
    <input type="button" value="Stop" onClick="StopSpeak" style="cursor:hand;">
    </center>
    </body>
    </html>

  11. #11
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2020
    Messages
    114
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Eure et Loir (Centre)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2020
    Messages : 114
    Points : 92
    Points
    92
    Par défaut
    Bonjour hackoofr !

    ce (HTA) est fantastique et surtout fonctionnelle ou dans le sens le text ce lis bien en français avec la voix de virginie donc bravo.

    maintenant une autre question car le script est génial peut on faire en sorte qu'il ce ferme à la fin de la vocalisation ???

    Nom : Capture.jpg
Affichages : 541
Taille : 77,1 Ko

  12. #12
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut

    Pour fermer le HTA, Il suffit d'ajouter Self.Close après la lecture
    Code HTML : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    <html>
    <head>
    <meta charset="utf-8" />
    <META HTTP-EQUIV="MSThemeCompatible" CONTENT="YES">
    <title>Get and Speaking Voices</title>
    <HTA:APPLICATION 
        APPLICATIONNAME="Get and Speaking Voices"
        SCROLL="no"
        SINGLEINSTANCE="yes"
        icon="narrator.exe"
        INNERBORDER="NO"
        MAXIMIZEBUTTON="NO"
        MINIMIZEBUTTON="YES"
    >
    <style type="text/css">
      body {
            font-family:Verdana;
            font-size: 10x;
            color: #49403B;
            background: LightGreen;
    }
    </style>
    </head>
    <script language="VBScript">
    Option Explicit
    Dim objOption,sapi
    Set sapi = createObject("sapi.spvoice")
    '----------------------------------------------------------------------------------------------------------------
    Sub CenterWindow( widthX, heightY )
        self.ResizeTo widthX, heightY 
        self.MoveTo (screen.Width - widthX)/2, (screen.Height - heightY)/2
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    Sub Window_OnLoad()
        CenterWindow 700,350
        Call getVoices()
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    Sub getVoices()
        Dim msg,Voices,Voice,i
        Set sapi = createObject("sapi.spvoice")
        set Voices = sapi.GetVoices
        ClearListbox
        OptVoices.style.backgroundcolor = "#13eac9"
        For each Voice in Voices
            i = i + 1
            Set objOption = Document.createElement("OPTION")
            objOption.Text = Voice.GetDescription & " - Index = "& (i - 1) & ""
            objOption.Value = i - 1
            OptVoices.Add(objOption)
        Next
    End sub
    '----------------------------------------------------------------------------------------------------------------
    Sub ClearListbox()
        For Each objOption in OptVoices.Options
            objOption.RemoveNode
        Next 
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    Sub SpeakIt(str)
        Dim msg, Voices
        set Voices = sapi.GetVoices
        Set sapi.Voice = Voices.Item(OptVoices.Value) 
        sapi.Speak str
        self.close
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    Sub PauseSpeak()
        sapi.pause()
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    Sub ResumeSpeak()
        sapi.Resume()
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    Sub StopSpeak()
       call sapi.Skip("Sentence","10")
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    Function Get_WAN_IP()
    Dim http
    Set http = CreateObject("Microsoft.XMLHTTP" )
    http.Open "GET", "https://ifconfig.me/ip", False
    http.Send 
    'msg.value = ""
    msg.value = "L'adresse ip publique est : "& http.responseText
    Pause "1"
    SpeakIt "L'adresse ip publique est : "& http.responseText
    Get_WAN_IP = http.responseText
    End Function
    '----------------------------------------------------------------------------------------------------------------
    Sub Pause(nSecondes)
        Createobject("wscript.shell").Run "cmd /c Ping -n "& nSecondes &"",0,True
    End Sub
    '----------------------------------------------------------------------------------------------------------------
    </script>
    <body>
    <center>
    <p><textarea id="msg" cols="70" rows="12">
    Si on prend un script en vbs la voix est en anglais. Si on prend un script en ( hta ) la voix est en français . Pourquoi? aucune idée?
     
    If we take a script in vbs the voice is in English. If we take a script in (hta) the voice is in French. Why? no idea?
    </textarea></p>
    <input type="button" id ="BtnVoices" value="Lire avec la voix" onClick="Call SpeakIT(msg.Value)" style="cursor:hand;">
    <select size="1" name="OptVoices" style="Width:370px;"></select>
    <br><br>
    <input type="button" value="Pause" onClick="PauseSpeak" style="cursor:hand;">
    <input type="button" value="Reprendre la lecture" onClick="ResumeSpeak" style="cursor:hand;">
    <input type="button" value="Stop" onClick="StopSpeak" style="cursor:hand;">
    <input type="button" value="Get WAN IP" onClick="Get_WAN_IP" style="cursor:hand;">
    </center>
    </body>
    </html>

  13. #13
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2020
    Messages
    114
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Eure et Loir (Centre)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2020
    Messages : 114
    Points : 92
    Points
    92
    Par défaut
    Merci Hackoofr.

    Maintenant que l'on peut avoir la voix en français.

    Peut on vocalises le nombre de dossier ce trouvant dans un répertoire???

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Nombre de dossiers et sous dossier géré par linux
    Par frog974 dans le forum Administration système
    Réponses: 4
    Dernier message: 05/09/2007, 10h08
  2. Nombre d’articles le plus vendu
    Par sam01 dans le forum Requêtes
    Réponses: 6
    Dernier message: 13/01/2007, 16h13
  3. [SQL] Compter le nombre de dossiers, pas le nombre d'enregistrements
    Par lodan dans le forum PHP & Base de données
    Réponses: 10
    Dernier message: 11/01/2007, 19h42
  4. Réponses: 4
    Dernier message: 27/11/2006, 23h24
  5. [SQL Server] nombre de dossier à une étape donnée
    Par mister3957 dans le forum Langage SQL
    Réponses: 12
    Dernier message: 17/09/2006, 11h35

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo