[jawsscripts] Com: was How might I code up a table to appear in virtual viewer?
- From: "Sean Randall" <seanr@xxxxxxxxxxxxxxx>
- To: <jawsscripts@xxxxxxxxxxxxx>
- Date: Thu, 19 Feb 2009 12:32:15 -0000
Geoff,
To quote a help file I read long ago:
"COM stands for "Component Object Model". It is the Microsoft way to
interconnect software using a common interface. These interfaces are
defined in a COM Object."
Com objects have properties (think of them as variables), and methods (think
of them as functions). it is with these that you interact with your Com
objects.
Lots of applications, services etc have a Com component to them - Bryan
Garaventa's new script module for updating scripts on-the-fly uses some
Microsoft ones to download files from the web.
if you want a brief example of Com at work, though, we can play with the
SAPI object.
SAPI is a speech synthesizer interface as you probably know. using the Com
interface SAPI provides, applications can speak using any SAPI synthesizer
installed on the user's machine.
This is how most speech-enabled (or self-voicing) products work. Screen
readers are generally the exception to this rule as they interface with the
synthesizers directly (although JAWS does have SAPI support of course).
Before we can use any Com object we need a variable for it.
;__
Var
Object SAPI
;__
Gives us an object Variable to play with.
The next thing we need to do is to create the object (i.e. tell the object
variable what object it's supposed to use).
;__
let SAPI = createObject("SAPI.SpVoice")
;__
The "SAPI.spVoice" bit comes from the SAPI5 documentation - which you can
download from Microsoft. Lots of the Com objects you can use have online
documentation and, although you'll not find anything aimed specifically at
JAWS script, certain things are applicable.
as I mentioned before,, Com objects use properties as variables. you can
only use properties that the object has defined. In this case, there are
"rate" and "volume" properties. If you wanted to have your SAPI speech
slightly faster than normal and at half the volume, you might code
;__
let SAPI.rate = 3
let SAPI.volume = 50
;__
The next thing are methods (or functions). if you wanted SAPI to speak a
string of text, you might use:
;__
SAPI.speak("hello world!",0)
;__
The parameters that these methods take are also to be found in the
documentation.
There's more to Com than this - but hopefully this little example has given
you something to think about.
I'm sorry for using such a useless example - the last place you'd need to
incorporate SAPI speech is inside of a screen reader, but its the object I
know best.
Sean.
-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Geoff Chapman
Sent: Thursday, February 19, 2009 12:20 AM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: How might I code up a table to appear in virtual
viewer?
Wow! ok!
Thanks to Jim and Sean and James for most welcome input on this one.
And especially for specific code examples syntax! I would've had no idea.
confession ignorance time now,
i've never used objects before in my life! nor have I ever really understood
them either.
Thanks for the input guys, I will give this a shot, though I've absolutely
know idea what I'm doing here!
<grin.>
I don't know what Com objects are either or how I might go about learning
their meaning/usage. though I've heard them spoken about lots up here and
they sound mighty powerful puppies if one could harness their effective
usage.
is there a particular document I might read or code I might study with
stacks of comments intimating a teaching type environment?
From my reading, except for the introduction of the word, Com, it sounds
kinda like Sean and Jim bower were on the same page here with this. is that
correct?
one big question I have immediately though.
Where Jim has indicated the function line:
ODoc.write("whateverYouWantHere, would be your HTML in this instance")
from which I glean that all must be inside quotation marks as the single
parameter to ODoc.write,
But will it cope happily with line breaks all over the place within this?
For in some instances in functions, I've found some functions don't seem to
cope with lineBreaks, and other's do? I've not yet worked out the deal with
that either. SayStrings seem to cope ok with them, at least in my
experience where you close quotes, and then put a line break and put plus,
then open new quote, new string stuff, close quotes, new line break, plus,
etc.
But, where you've got one parameter that's gotta all be inside one set of
quotation marks. is this gunna work across linebreaks would you think?
or do I somehow need to write all the html code in another method designed
to put it all into a string, and then put that string into the quotation
marks as the parameter in ODoc.write?
Sorry so much ignorance going on here.
I will give it a trial now, and may have more questions when I've done that.
__________
Visit and contribute to The JAWS Script Repository http://jawsscripts.com
View the list's information and change your settings at
http://www.freelists.org/list/jawsscripts
Other related posts:
- » [jawsscripts] Com: was How might I code up a table to appear in virtual viewer? - Sean Randall