Op 25-06-2023 om 22:46 schreef James Richters via fpc-pascal:
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,
and it’s SO simple to do with a VBS script in just 3 lines and it just
works!(it would only be 2 lines if I didn’t want Microsoft Zira)
You didn't mention the version of FPC/Lazarus you were using.
I had a simple example which worked for me (but your example also
directly worked for me in trunk).
program Project1;
{$mode objfpc}{$H+}
uses
Classes, ComObj;
var
Voice: olevariant;
begin
Voice := CreateOLEObject('SAPI.SpVoice');
Voice.Speak('I am speaking.', 0);
Voice.Speak('I am also speaking.', 0);
end.
I didn't even have the problem with any EZeroDivide exception.
--
Grtz,
Rik van Kekem
_______________________________________________
fpc-pascal maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal