<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Op 25-06-2023 om 22:46 schreef James
      Richters via fpc-pascal:<br>
    </div>
    <blockquote type="cite"
      cite="mid:017b01d9a7a6$1ab1cd10$50156730$@productionautomation.net"><span
style="mso-ascii-font-family:Calibri;mso-hansi-font-family:Calibri;mso-bidi-font-family:"Times
        New Roman"">I gave up on doing it directly, it seems SO
        convoluted to do with FPC with the COM unit and all this stuff I
        just don’t understand, <o:p></o:p></span><br>
      <span
style="mso-ascii-font-family:Calibri;mso-hansi-font-family:Calibri;mso-bidi-font-family:"Times
        New Roman"">and it’s SO simple to do with a VBS script in
        just 3 lines and it just works!<span style="mso-spacerun:yes"> 
        </span>(it would only be 2 lines if I didn’t want Microsoft
        Zira)</span></blockquote>
    You didn't mention the version of FPC/Lazarus you were using.<br>
    <br>
    I had a simple example which worked for me (but your example also
    directly worked for me in trunk).<br>
    <br>
    <font face="monospace" color="#004000">program Project1;<br>
      {$mode objfpc}{$H+}<br>
      uses<br>
        Classes, ComObj;<br>
      var<br>
        Voice: olevariant;<br>
      begin<br>
        Voice := CreateOLEObject('SAPI.SpVoice');<br>
        Voice.Speak('I am speaking.', 0);<br>
        Voice.Speak('I am also speaking.', 0);<br>
      end.</font><br>
    <br>
    <div class="moz-signature">I didn't even have the problem with any
      EZeroDivide exception.<br>
      <br>
      -- <br>
      Grtz,<br>
      Rik van Kekem<br>
      <br>
    </div>
  </body>
</html>