Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Steve Litt via fpc-pascal
Steve Litt via fpc-pascal said on Mon, 26 Jun 2023 22:26:17 -0400 >Where does one get ComObj? On my box this errored out with: I went off half cocked. I'm using Linux. Is ComObj even available on Linux? Would you expect Voice := CreateOLEObject('SAPI.SpVoice') and Voice.Speak('I am speaking.',

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Steve Litt via fpc-pascal
Rik van Kekem via fpc-pascal said on Mon, 26 Jun 2023 16:12:06 +0200 >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.',

Re: [fpc-pascal] Subscript pointers

2023-06-26 Thread Steve Litt via fpc-pascal
Hairy Pixels via fpc-pascal said on Mon, 26 Jun 2023 18:52:16 +0700 >> On Jun 26, 2023, at 3:48 PM, Steve Litt via fpc-pascal >> wrote: >> >> Why do you need pointers at all? Pointers aren't *usually* an asset. >> > >Seriously? anytime you allocate something on the heap you need a >pointer.

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread James Richters via fpc-pascal
Well that's worth a lot, it may be indicating a bug in 3.3.1? I guess I need to get on the current trunk to see if it's still misbehaving. James >Also, for what it's worth, your code works fine on fpc 3.20. ___ fpc-pascal maillist -

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread James Richters via fpc-pascal
I was using OleVarient and Varient. How can I check to see if CreateOleObject was successful? James >It sounds like " SpVoice := CreateOleObject('SAPI.SpVoice');" is failing and >then SpVoice is nil ? >May be try with an OleVariant instead of a simple Variant ? (i.e declare var >SpVoice:

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Travis Siegel via fpc-pascal
Also, for what it's worth, your code works fine on fpc 3.20. On 6/26/2023 11:04 PM, James Richters via fpc-pascal wrote: I appreciate the help with this. I'm still confused. In my original post, I already had CoInitialize, CoUninitialize; and Unit ComOBJ, Unit Windows and Unit ActiveX I

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Travis Siegel via fpc-pascal
Hmm, ok, apparently something changed in the way FPC handles objects between 3.31 and 3.20 (the version I'm using). Thought I had 3.22, but . I guess it could be a sapi version difference too, but I don't know how to check that. On 6/26/2023 11:15 PM, James Richters wrote: When I run the

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Jean SUZINEAU via fpc-pascal
It sounds like "SpVoice := CreateOleObject('SAPI.SpVoice');" is failing and then SpVoice is nil ? May be try with an OleVariant instead of a simple Variant ? (i.e declare var SpVoice: OleVariant; ) ___ fpc-pascal maillist -

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread James Richters via fpc-pascal
When I run the code below I get: An unhandled exception occurred at $004143C0: ■ Free Pascal IDE Version 1.0.12 [2022/02/07] ■ Compiler Version 3.3.1-10077-gc8403ad49e ■ GDB Version GNU gdb (GDB) 7.2 Running "i:\programming\sapi.exe " EOleError: Variant does not reference an automation object

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread James Richters via fpc-pascal
I appreciate the help with this. I'm still confused. In my original post, I already had CoInitialize, CoUninitialize; and Unit ComOBJ, Unit Windows and Unit ActiveX I was still getting EOleError: Variant does not reference an automation object. Do I need to do all this Change FPU stuff?

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Travis Siegel via fpc-pascal
On 6/26/2023 6:26 PM, Michael Van Canneyt via fpc-pascal wrote: On Mon, 26 Jun 2023, James Richters wrote: I tried to make your example into a FPC program without Lazarus: {$mode objfpc}{$H+} uses  comobj; var  SavedCW: Word;  v: OleVariant; begin   v:=CreateOleObject('SAPI.SpVoice');  

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Travis Siegel via fpc-pascal
On 6/26/2023 3:51 PM, Michael Van Canneyt via fpc-pascal wrote: Try changing the selected voice to 0 instead of 1. Yeah, already tried that, didn't help any. *grumble* Because I use a screen reader, I have multiple sapi voices installed, (though I rarely use them), but I haven't played with

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Michael Van Canneyt via fpc-pascal
On Mon, 26 Jun 2023, Marco van de Voort via fpc-pascal wrote: On 26-6-2023 20:26, Michael Van Canneyt via fpc-pascal wrote: I suspect COM is not properly initialized, and that Lazarus does this for you. (it needs com for some components on windows) So, try adding unit windows to the

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Marco van de Voort via fpc-pascal
On 26-6-2023 20:26, Michael Van Canneyt via fpc-pascal wrote: I suspect COM is not properly initialized, and that Lazarus does this for you. (it needs com for some components on windows) So, try adding unit windows to the uses clause and add CoInitialize(nil); as the first statement of

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Michael Van Canneyt via fpc-pascal
On Mon, 26 Jun 2023, Michael Van Canneyt via fpc-pascal wrote: On Mon, 26 Jun 2023, James Richters wrote: I tried to make your example into a FPC program without Lazarus: {$mode objfpc}{$H+} uses comobj; var SavedCW: Word; v: OleVariant; begin v:=CreateOleObject('SAPI.SpVoice');

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Michael Van Canneyt via fpc-pascal
On Mon, 26 Jun 2023, James Richters wrote: I tried to make your example into a FPC program without Lazarus: {$mode objfpc}{$H+} uses comobj; var SavedCW: Word; v: OleVariant; begin v:=CreateOleObject('SAPI.SpVoice'); v.Speak('Hello'); End. I get: Running

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread James Richters via fpc-pascal
I was trying to figure this out on my own.. I went to: https://wiki.freepascal.org/SAPI that is where I got my advice. I took the top example code from the link and made it into the following program: {$Mode OBJFPC} uses comobj; var SavedCW: Word; SpVoice: Variant; begin SpVoice :=

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Michael Van Canneyt via fpc-pascal
On Mon, 26 Jun 2023, Travis Siegel via fpc-pascal wrote: Thank you, this one works for me with a command line compile.  I compared the two programs, and the line that asks for the voices is the culprit. I'll have to do some digging to see why that line breaks the runtime execution. Try

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Travis Siegel via fpc-pascal
Thank you, this one works for me with a command line compile.  I compared the two programs, and the line that asks for the voices is the culprit. I'll have to do some digging to see why that line breaks the runtime execution. But at least I can make it work now.  I'd always used powerbasic

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Travis Siegel via fpc-pascal
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

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Michael Van Canneyt via fpc-pascal
On Mon, 26 Jun 2023, Marco van de Voort via fpc-pascal wrote: On 26-6-2023 15:54, Michael Van Canneyt via fpc-pascal wrote:   v.Voice:=v.GetVoices().Item(1); I have to change that to (0) to get it to work. Might depend on configuration? Probably the number of voices installed in the

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Rik van Kekem via fpc-pascal
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

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Marco van de Voort via fpc-pascal
On 26-6-2023 15:54, Michael Van Canneyt via fpc-pascal wrote:   v.Voice:=v.GetVoices().Item(1); I have to change that to (0) to get it to work. Might depend on configuration? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Michael Van Canneyt via fpc-pascal
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

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread 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) So I decided to do this

Re: [fpc-pascal] Subscript pointers

2023-06-26 Thread Hairy Pixels via fpc-pascal
> On Jun 26, 2023, at 3:48 PM, Steve Litt via fpc-pascal > wrote: > > Why do you need pointers at all? Pointers aren't *usually* an asset. Seriously? anytime you allocate something on the heap you need a pointer. Classes are pointers even. Regards, Ryan Joseph

Re: [fpc-pascal] Subscript pointers

2023-06-26 Thread Steve Litt via fpc-pascal
Hairy Pixels via fpc-pascal said on Sun, 25 Jun 2023 11:20:53 +0700 >> On Jun 24, 2023, at 8:00 PM, Steve Litt via fpc-pascal >> wrote: >> >> I don't do much with Pascal pointers, but it looks to me like you: >> >> * Set p to the address of i >> * Set the contents of p to 100 >> * Read the