Need Help Writing to JAWS Please!

Just starting out? Need help? Post your questions and find answers here.
CodingBlind
New User
New User
Posts: 9
Joined: Wed Mar 22, 2023 5:39 pm

Need Help Writing to JAWS Please!

Post by CodingBlind »

Hello,

As suggested by my username, I am a person who is blind. Therefore, I would like to be able to programmatically write messages to be spoken and call functions in my JAWS For Windows screen reading software (https://en.wikipedia.org/wiki/JAWS_(screen_reader)).

Thus far, my coding efforts have failed to locate the WriteString function. Also, using OpenLibrary, I can only locate the dll by specifying its full path. I suspect I am going to need to use a Prototype?

The jfwapi.dll is located in the JAWS folder, but not in either of the Windows system folders.

I found it curious that the PureBASIC Help Manual states that each version of the compiler (32-bit or 64-bit) can only work with libraries of same type. Meanwhile, the Prototype example, that I copied and run, was accessing the System32.dll

At the risk of falling foul of forum rules, I will paste below an example from the Freedom Scientific Developers Network FSDN documentation.

If you want your program to make JAWS say, Braille, or do something, you can use the FS API to do it. FSAPI.DLL contains a COM object as well as several exported functions. This means you can call it through COM. You will not have to know where FS API lives on the user system, as you would if it were linked statically. But you can also call FSAPI functions exports as declared in FSAPI.H if COM cannot be used.

We strongly recommend using COM because this obviates the need to determine where on the system FSAPI.DLL resides and dynamically load the library. You cannot really staticly bind to fsapi.lib because your program will not start if FSAPI.DLL does not reside in the same directory as the directory where your program is installed. The COM approach does not suffer from these same limitations.

Note: In Visual Basic, the apostrophe is used for comments rather than the semicolon.
A VBScript example of using the COM object is:


Set o = CreateObject("freedomsci.jawsapi")
' Creates the object variable pointing to FSAPI.
Call o.SayString("Hello and Hi")
' Accesses the member function sayString from FSAPI.
Call o.RunFunction("sayline")
' Accesses the member function sayString from FSAPI.


The available functions are described below.

SayString

NAME SayString
PURPOSE
Instructs Jaws to speak a string of text.
USAGE
SayString(StrinToSpeak,bInterrupt);
PARAMETERS
StrinToSpeak the text to be spoken
bInterrupt whether or not to discard any text already being spoken at the time this function is called. If this parameter is TRUE, any
text currently being spoken will be discarded.
RETURNS
TRUE ifJaws is running and if the text was scheduled to be spoken.
FALSE if the text was not scheduled to be spoken.
REMARKS
This function will return before the text has finished speaking


I would be most grateful for any help with this project!

Wayne
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Need Help Writing to JAWS Please!

Post by infratec »

I'm not a COM expert, but you can give it a try:

Code: Select all

EnableExplicit

XIncludeFile "COMatePLUS.pbi"


Define.COMateObject o

o = COMate_CreateObject("FreedomSci.JawsApi")
If o
  o\Invoke("SayString('Hello from PureBasic')")
  o\Release()
Else
  MessageRequester("JAWS", COMate_GetLastErrorDescription())
EndIf
https://backups.rsbasic.de/COMatePLUS.zip

You need 2 files out of the zip:
COMatePLUS.pbi
COMatePLUS_Residents.pbi
Last edited by infratec on Thu Aug 15, 2024 8:15 pm, edited 1 time in total.
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Need Help Writing to JAWS Please!

Post by infratec »

Btw. there is an other blind programmer active in this form.
Quin
Addict
Addict
Posts: 1135
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Need Help Writing to JAWS Please!

Post by Quin »

Why not try Tolk? It has native PureBasic bindings included :)
I also wrapped Universal Speech into PB for an application, but I haven't ever cleaned it up fully and released it.
Calling COM objects in PB is most definitely not my favorite, and I fear you may be in for a a rough ride if you want to do this entirely from PB. That said I know of a blind PB programmer who's spoken to JAWS before, I'll give them a ping.
Quin
Addict
Addict
Posts: 1135
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Need Help Writing to JAWS Please!

Post by Quin »

infratec wrote: Wed Aug 14, 2024 9:24 pm Btw. there is an other blind programmer active in this form.
That would be me, at your service :-)
CodingBlind
New User
New User
Posts: 9
Joined: Wed Mar 22, 2023 5:39 pm

Re: Need Help Writing to JAWS Please!

Post by CodingBlind »

Hello infratec and Quin,

Thank you for your very prompt responses.

infratec, Unfortunately, I got a connection refused message, when attempting to download the zip you recommended.

Quin, Toke sounds very promising! I went to Github, but received the message "message":"Artifact not found or access denied.". I guess I need to create an account there to download code? I had understood it was only necessary to post material.

It is breakfast time here and I have not been to bed.

I shall pursue this later.

Again, thank you so much for your positive replies!
User avatar
idle
Always Here
Always Here
Posts: 6021
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Need Help Writing to JAWS Please!

Post by idle »

GitHub had an outage, that was reason you couldn't download the zip. It's back up and running now.
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Need Help Writing to JAWS Please!

Post by infratec »

I just checked the link: it works

https://backups.rsbasic.de/COMatePLUS.zip

Or use the main page and scroll down:

https://www.rsbasic.de/backups
nsstudios
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Aug 28, 2019 1:01 pm
Location: Serbia
Contact:

Re: Need Help Writing to JAWS Please!

Post by nsstudios »

The Comate link technically works but trying to download the file fails in Firefox for whatever reason.
Using PB and

Code: Select all

ReceiveHTTPFile("https://backups.rsbasic.de/COMatePLUS.zip", GetUserDirectory(#PB_Directory_Downloads)+"COMatePLUS.zip")
works though for whatever reason.
This Tolk link should work for a pre-built package.
Tolk would probably be the easiest, followed by Comate if you can get it.
Infratec's Comate example should work.[*]
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Need Help Writing to JAWS Please!

Post by infratec »

Corrected the listing above.
CodingBlind
New User
New User
Posts: 9
Joined: Wed Mar 22, 2023 5:39 pm

Re: Need Help Writing to JAWS Please!

Post by CodingBlind »

nsstudios, Many thanks for the direct link to the Toke package. Based on advice from Quin, that talking to JAWS would otherwise be difficult with PureBASIC, I will be happy to work with Toke.

As I am far from an advanced programmer, even this will be quite a challenge for me.

Again, Many Thanks to all for your timely responses to my question.
Post Reply