[jawsscripts] Re: JAWS script how you alphabetize items or compare

  • From: "John Martyn" <johnrobertmartyn@xxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Thu, 29 Mar 2012 13:22:51 -0700

I think the easiest way to overcome this is just do a string segment of the
segment in question and I, then iterate to find the string that matches it
in a while statement and use the safety count to determine what line you
were on. At least I think that would work. It wouldn't be exact for
duplicate items in the list thus bring you to the first selection of the
same named items, but this is better than nothing. Also I am really thinking
about aborting the alphabetizing function since the string comparisons
differ so much among JAWS versions. It's not perfect, but it should work.
I'll write back if my silly idea works.
John

-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Doug Lee
Sent: Thursday, March 29, 2012 12:36 AM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: JAWS script how you alphabetize items or compare

Yes, that line makes JAWS 13's operators work for comparisons like they did
in JAWS 12 and before.

I finally broke down and wrote a function to test this myself. I thus
verified why it's happening:  In the DlgSelectItemInList call, the parameter
after nSort, the index to start on, represents how far from the top of the
list on screen to start, not how far from the start of the string. This may
and may not be by design, but it is how the function works.

My function:

void function dsilTest()
var string segs = "dog|cat|lion|bear|tiger|rhyno|horse"
var int i = 1
while i
        ; The selected item is the ith from the top on screen, not the ith
from the start of the string.
        i = DlgSelectItemInList(segs, "Select an Animal", True, i)
        sayInteger(i)
endWhile
endFunction

On Wed, Mar 28, 2012 at 11:21:48PM -0700, John Martyn wrote:
Interesting news. I wrote a function that kind of works, at least
alphabetizing the list, now I need to get the numbers to match up.
I'll have to test this with JAWS 12, but doesn't this string at the top make
JAWS 13 act more like JAWS 12 and below with string comparisons?
;#pragma StringComparison partial
John
-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Doug Lee
Sent: Wednesday, March 28, 2012 10:31 PM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: JAWS script how you alphabetize items or compare

The StringCompare() function is probably better for comparing strings for
less/greater/equal. StringToInt does not help for this unless the strings
are, or begin with, digits. But yes, the comparison operators do a sort of
comparison. The precise nature of this comparison is a bit interesting and
is different by default in JAWS 13 than in JAWS 12 and older.

On Wed, Mar 28, 2012 at 09:42:27PM -0700, John Martyn wrote:
JAWS 12 does the same thing. But there is hope. I can resort the list
containing the item name and item number just like what I did with the
segment1 and segment2 function I put out there. I could write this one too
One other thing I noticed is that you can compare string values to see what
is higher. The character A being the lowest and Z being the highest. Try it
out. I just put ABB and ABC in the comparison below.
if "abb" < "abc" then
SayString("yes")
endif
Interesting that you can compare strings for values. I guess string to int
isn't needed.
John
-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Doug Lee
Sent: Wednesday, March 28, 2012 9:03 PM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: JAWS script how you alphabetize items or compare

We might have to look at your actual code to figure this one out then.
I don't think DlgSelectItemInList() actually reorders the items in the
segmented string you pass to it, so item 23 should be the 23rd item in the
segmented list, not the 23rd item down on screen when the list is sorted.

If you're saying DlgSelectItemInList really is reordering things in your
segmented string, which would surprise me greatly, just copy it somewhere
and then copy it back just before each DlgSelectItemInList call.

Does that help?

On Wed, Mar 28, 2012 at 08:58:23PM -0700, John Martyn wrote:
I know, that was just an example. The actual code is with the 0 being a 1 to
sort it. But it doesn't seem to focus the correct item when it returns to
the while statement.
When I sort it, the I gives me a value of 23 if I pick the third item in the
list. When I is set, I make it focus back on the variable I, but it actually
goes to the 23 item in the list. I hope I am explaining this as best as I
can. It seems to focus the item, the rearrange the list after. That's what
I'm referring to.
John

-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Doug Lee
Sent: Wednesday, March 28, 2012 8:05 PM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: JAWS script how you alphabetize items or compare

You're passing 0 in that last call, indicating you don't want the list
sorted that time. If you sort it the first time and you want i to be valid
for another call, you'll need to sort it the second and subsequent times
also. Otherwise, the lists themselves are not equal, and item 3 is no longer
what item 3 was before.

On Wed, Mar 28, 2012 at 07:47:26PM -0700, John Martyn wrote:
I think I found a bug in the jaws script. When you DLGSelectItemFromList and
arrange it in alphabetic order, it gives you the correct value when you
assign it to a variable such as int I, but if you remain in the function in
a loop, it doesn't retain which index you are to properly  set you on. For
example say I have the following segmented string.
Let someSegment = "dogs|cats"

Naturally if you don't alphabetize it in the function, dogs will come up
first unless you put the flag of 1 in the built in function. Now, you can
string segment it to get the right information, but when it calls another
function that returns back to this dialog window, I wanted the previous
selection to be active. The result,I = DLGSelectDialog (someSegment,
"|",0,i)

The I at the end of that function should return you to the previous item in
the list with focus. But it doesn't return you to the same item if you sort
the list inside the function call.

This bug is annoying so I have to find a way around it.

If I can alphabetize the string segment before it goes into the dialog, that
would work, but how do you compare two words to be alphabetical?

I can think of a long drawn out process that will drive me insane, but
possible. 

Is there any built in function that will help me out possibly?

Thanks,

John Martyn



__________???

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

--
Doug Lee, Senior Accessibility Programmer SSB BART Group -
Accessibility-on-Demand mailto:doug.lee@xxxxxxxxxxxxxxxx
http://www.ssbbartgroup.com "While they were saying among themselves it
cannot be done, it was done." --Helen Keller __________o?=

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

__________???

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

--
Doug Lee, Senior Accessibility Programmer SSB BART Group -
Accessibility-on-Demand mailto:doug.lee@xxxxxxxxxxxxxxxx
http://www.ssbbartgroup.com "While they were saying among themselves it
cannot be done, it was done." --Helen Keller __________o?=

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

__________???

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

--
Doug Lee, Senior Accessibility Programmer SSB BART Group -
Accessibility-on-Demand mailto:doug.lee@xxxxxxxxxxxxxxxx
http://www.ssbbartgroup.com "While they were saying among themselves it
cannot be done, it was done." --Helen Keller __________o?=

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

__________???

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

--
Doug Lee, Senior Accessibility Programmer SSB BART Group -
Accessibility-on-Demand mailto:doug.lee@xxxxxxxxxxxxxxxx
http://www.ssbbartgroup.com "While they were saying among themselves it
cannot be done, it was done." --Helen Keller __________o?=

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


__________�

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

Other related posts: