[jawsscripts] Help with StringSegmentCount

  • From: "Donald Marang" <donald.marang@xxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Tue, 30 Jun 2009 01:46:40 -0400

I have been getting unreliable results with the StringSegmentCount function.  
What is the appropriate delimiter for lists and segments?  The 
GetListOfFormFields and DLGSelectItemInList functions seem to work correctly 
whether I use "|", "\007" or even "/007".  I don't understand the "/007" as a 
delimiter, but it was described in the FSDN description for one of these 
segment functions.  When I use "|", on a webpage with 2 edit fields, 
"DIRECTV.com Username/Email" and Password", the StringSegmenntCount returns 1!  
When I use "\007", it returns 3!  Surprisingly, "/007" returns the correct 
value of two.  But I think this is actually using "/" as the delimiter, since 
the StringSegment function returns just "DIRECTV.com Username".
I am not really wanting to display a list to select a field.  I just want the 
number of edit fields and later the number of buttons in the form.  However, 
getting the right syntax for a collection of edit fields (INPUT type='text' or 
'password') and buttons (INPUT class='actionbutton') has eluded me.  Otherwise, 
I would just use the length parameter, like:
Let iFields = oCollection.length

Am I making a fatal mistake?

Here is a portion of the code:
let oDoc = ieGetCurrentDocument ()

Let sURL = oDoc.url ; Creates the URL of the current page

Let oForm = oDoc.forms(0) ; the only form 

 let sEditFields=GetListOfFormFields ("|", WT_EDIT)
 Let iFields = StringSegmentCount (sEditFields, "|")
 SayMessage (OT_DEBUG, "There are " + IntToString (iFields) + "edit field 
segments in the list:  \"" + sEditFields + "\"")
 let iCurrentIndex=GetFormFieldIndex(WT_EDIT)
 let iIndex = DlgSelectItemInList (sEditFields, "List of Edit Fields", 
False,iCurrentIndex)
 SayMessage (OT_DEBUG, "selected:  " + IntToString (iIndex))
 Let sFirstEditBoxName = StringSegment (sEditFields, "|", 1)

Don Marang


__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

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

Other related posts:

  • » [jawsscripts] Help with StringSegmentCount - Donald Marang