Does the form code do something different than the command line? When I
try to run this code, I get an unhandled exception error.
Any idea how to fix?
On 6/26/2023 1:54 PM, Michael Van Canneyt via fpc-pascal wrote:
On Sun, 25 Jun 2023, James Richters via fpc-pascal wrote:
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)
I don't know what people advised you, but what you want to do needs 3
lines
of code only:
I created a lazarus application, dropped a button and in the onclick I
call
speak('hello'). It just works.
--
uses comobj;
procedure speak(s : string);
var
v : olevariant;
begin
v:=CreateOleObject('SAPI.SpVoice');
v.Voice:=v.GetVoices().Item(1);
v.Speak(s);
end;
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
speak('hello');
end;
--
No need to write a script, call tprocess etc. You can do everything
right in fpc as simple as this.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal