[jawsscripts] Re: collection datatype

  • From: "David Farough" <David.Farough@xxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Wed, 28 Jul 2010 12:16:15 -0400

I have it in version 11.0.1461
I found it in the default scripts in the GetTermForResearchIt
function.

* extracted text follows.
string Function getTermForResearchIt ()
var
        collection here
let here = new collection
;Basic demonstration of how collections work within JAWS.
;This is of course a bit simplistic and the uses are far more
wide-ranging than here, but at least the basic idea gets conveyed.
;final note on collections in general - there is no arraycopy or
collectioncopy so if you pass it around, it's byref / the address to the
original.
;You'd need to for / forEach through it and independently make your own
copy if that's what you want,
; but could be memory-intensive.
;this is really simplistic collection.
;We never want selected text anywhere if the JAWS or invisible cursor
is active:
if ! isJAWSCursor () && ! isInvisibleCursor () then
        let here.selectedText = getSelectedText ()
endIf
let here.word = getWord ()
let here.window = getFocus ()
let here.class = getWindowClass (here.window)
let here.type = getWindowSubtypeCode (here.window)
if ! here.type  then
        let here.type = getObjectSubtypeCode (TRUE)
endIf
let here.isMultiline = (here.type == wt_MULTILINE_EDIT
 || getWindowStyleBits (here.window) & ES_MULTILINE
 ;|| stringContains (getActiveCursorName (), cscFSDomCursorName); FSDom
can run in single-line edit controls
 || here.class == cwc_Word_Document || here.class == cwc_Word_Document2
|| here.class == cwc_WordPerfect_Document
);
let here.AcceptsSelection = isVirtualPcCursor () || (isPcCursor () &&
here.isMultiline)
if here.AcceptsSelection then
        if here.selectedText then
                return here.selectedText
        else
        return here.word
        endIf
elIf ! here.selectedText && (here.type == WT_EDIT || here.type ==
WT_READONLYEDIT || stringContains (here.class, "edit")) then
        return here.word
elIf !isPcCursor () then
        return here.word
else
        return cscNull
endIf
;not necessary for a local script call but invaluable if the collection
has been passed around.
;The last pointer that drops the collection causes internal garbage
collection, aka no scrubbing needed by you
;Obviously since collections / arrays are done byref only dereference
when you or whoever's using your collection doesn't need it anymore.
let here = null();variant nothing = dump it
endFunction




David Farough
Application Accessibility Coordinator/coordonateur de l'accessibilité 
Information Technology Services Directorate /
Direction des services d'information technologiques
Public Service Commission / Commission de la fonction publique
Email / Courriel:  David.Farough@xxxxxxxxxxxxx
Tel. / Tél:    (613) 992-2779 

>
This e-mail message is intended for the named recipient(s) and may
contain information that is privileged, confidential and/or exempt from
disclosure under applicable law. Unauthorized disclosure, copying or
re-transmission is prohibited. If you are not a named recipient or not
authorized by the named recipient(s), or if you have received this
e-mail in error, then please notify the sender immediately and delete
the message and any copies.
 >
Ce courriel est destiné exclusivement au destinataire mentionné en titre
et peut contenir de l'information privilégiée, confidentielle ou
soustraite à la communication aux termes des lois applicables. Toute
divulgation non autorisée, toute reproduction ou réacheminement est
interdit. Si vous n'êtes pas le destinataire de ce courriel, ou n'êtes
pas autorisé par le destinataire visé, ou encore, si vous l'avez reçu
par erreur, veuillez le mentionner immédiatement à l'expéditeur et
supprimer le courriel et les copies.      

__________�

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

Other related posts: