[jawsscripts] Re: chopping up block of text on Tab delimiters or via color? String monipulation,

  • From: "Geoff personal" <gch@xxxxxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Tue, 24 Mar 2009 15:41:01 +1100

Wow Paul and Donald! this is all just fantastic stuff for me! thank you 
thank you so much to both of you for your kind energies and efforts, and for 
providing invaluable example code here for me of these function usages.
 There's lots here I've never used, and it sounds like it'd be helpful for 
me to get to grips with all of this.

What I've done today is firstly try Paul's approach, since I recieved it 
first.
After some time, ... ok a lot of time, diddling with this, what it appears 
to me like is happening is,
The GetTextInRect function I'm using to grab blocks of data from the screen, 
seems to me, somehow, to be actually AutoConverting the "\9" tab characters, 
to spaces in my string! Before the
StringReplaceSubstrings function gets time to do it's stuff.

So that by the time it does, there's no tabs left in the string to be found!



is that possible? probible?

Then, I thought that perhaps this GetTextInRect function, upon only 
recieving the 4 parameters of Left, top, right, and bottom, might feel it 
was being given permission to strip out Tabs automatically, because I wasn't 
asking it to keep lineBreaks as a whole block.
But that's not it either, as when I fill in all 8 of the parameters, 
including a 1 at the end to retain LineBreaks, it still doesn't seem to 
work.

So, when I follow Paul's logic, By the way I never ever knew that the tab 
character had a value of "\9", nor that spaces had one of "\32" before,
But, thanks to this great coding help,
I do now!
so, as I say when I use paul's logic, and insert the word "Blonk. " in 
quotes where he previously had coded a period character, as I'd indicated I 
desired,
just to make things reeeally clear to me,
when I replace "\9", with "\32", like this:
(Oh I've also altered Paul's example stringCode names a bit as well to suit,



;let sAnnouncePromptsWithPauses = StringReplaceSubstrings 
(sFunctionKeyPrompts, "\32", "Blonk. ")


It's putting the word "Blonk" in my resultant string every single place it 
sees not only a space, (which of course appears sometimes between the 
wordings of the function Key options themselves, so is obviously quite 
non-optimal,
but also whenever it sees the Tab delimiters!
Which is just so weird!
So it thinks they're spaces too!
Has anyone ever encountered this before, and/or have any way around it such 
that the string gathering retains the tabs, with their character value of 
"\9", as is?

I've just tested GetTextInFrame,  and it does exactly the same thing!
ooooh man! I've just clarified this even more, by discovering that when I 
use a GetLine instead, then Paul's logic works a treat! and the tabs or "\9" 
characters, seem to indeed be retained in the string, and thus found by the
StringReplaceSubstrings, function!

So one wonders now, why on earth would certain stringGathering functions 
feel it their duty/ungiven permission, to treat Tabs as spaces!

<sigh.>



So I guess I'll have to do reeeeally crude and slow stuf like Routing jaws 
Cursor to certain spots and doing GetLine, nextLine, GetLine stuff, which is 
just sooo inelegant!

Any thoughts anyone?

To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Tuesday, March 24, 2009 1:15 PM
Subject: [jawsscripts] Re: chopping up block of text on Tab delimiters or 
via color? String monipulation,


>I know that this would not be the normal usage for the StringSegmebt
> functions.  But wouldn't these functions work if you use "\9", which is 
> the
> Tab character,  as the delimiter for  these functions in place of the
> typical "\7", which is the "|" character (or is it proper to use "\09" and
> "\07")  This could provide several easy features like a count of the
> segments (function key descriptions), easy extraction of a segment, and 
> even
> display the entire string in a list dialog for possible execution.
> Actually, it might be easier to substitute the "\9" for "|", and use the
> StringSegment functions in their more normal usage.
>
> For instance:
> Let sKey3 = StringSegment (sFunctionKeys, "\9", 3)
>
> would extract the third substring of the entire block of function keys 
> which
> are in the string sFunctionKeys
>
> or:
> Let sFunctionKeys = StringReplaceChars (sFunctionKeys, "\9", "|")
> ; replaces all tabs with the "|" character
>
> Let iChoice = DlgSelectItemInList (sFunctionKeys, "Funcction Key 
> selection",
> False, 3)
> ; Displays a list of the function keys and their descriptions with a title
> and the third highlighted by default
> ; The return value, iChoice, is the integer index of the item selected
>
> Let sKey = StringSegment (sFunctionKeys, "|", iChhoice)
> ; This would be the substring selected in the dialog.  Witth a little
> further manipulation or logic, you could have the function key executed
> Good luck.
>
> Don Marang
>
>
> ----- Original Message ----- 
> From: "Geoff personal" <gch@xxxxxxxxxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Sunday, March 22, 2009 9:19 PM
> Subject: [jawsscripts] chopping up block of text on Tab delimiters or via
> color? String monipulation,
>
>
>> aha Mighty Scripters.
>>
>> I wonder if someone might be able to assist me with some fancy string
>> monipulation knowledge?
>> I have a problem in a terminal emulation environment application I am
>> scripting, whereby there's this whole 3 line block of helper text for the
>> user , denoting the role of the function keys on any given screen.
>> However of course, they don't have nice periods after each one, nor even
>> commas, so speaking a GetTextInRect on the block of course just spiews
>> them
>> all out in one unpleasantly incomprehensible continuous stream of text.
>> However of course on each screen, the length of each function key
>> prompt/string of text which needs pauses inserted between them, and which
>> I
>> wish also to split up to place one below the other in the virtual viewer
>> upon a double click of this key,
>> alters!  Such that I can't just successfully delineate things with simple
>> static GetTextInRect functions.
>>
>> So, what I'm wondering, is, what other options might be available to me 
>> to
>> do this?
>> Now there are what Jaws identifies as, Tabs, sitting between each one,
>> which
>> I was thinking if I knew how to get functions to do something like this:
>> take the block of text, then move along till you find the first tab, then
>> chop that from the left and assign it to a string,
>> then move along to the next piece of actual text, starting counting from
>> there, then when you reach the next Tab, chop that out and assign it to
>> some
>> string, ... etc, I thought I could then achieve this.
>> But, I've no idea how I might go about doing this? I'm not at all really
>> adept yet at handling the return values of functions, and feeding them
>> into
>> new new functions
>> as parameters upon which the next function acts? Which I'm fairly sure is
>> what I'm going to be needing to be able to do, in order to achieve this
>> one?
>>
>> Or, the other thought I had was to maybe delineate by color instead.
>> All the actual text in the block, is CornFlower blue on Black. i.e, in
>> integer land,
>> 15765624 on 0.
>> Whereas the Tabs in between each helper prompt string that I wish to
>> insert
>> pauses into and be able to deal with individually in virtual viewer,
>> is the standard Lime Green on Black terminal emulation color. i.e. in
>> integer land,
>> 3201060 on 0.
>> Though interestingly, even with Hsc ReadPixel Color command, I'm unable 
>> to
>> find any pixels in my tab identified spot, that report themselves as that
>> Lime green color, even though JawsKey+top row 5, reports the tab as Lime
>> Green on black.
>>
>> Might I be able to utilize something which looked for color instead, to
>> achieve what I'm after?
>> What would people suggest might be the bestest approach for this.
>>
>> Thanks so much for any tips or exemplery code anyone might have time to
>> throw up at me on this one.
>>
>> geoff c.
>>
>>
>>
>> __________
>> 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
>>
>
> __________
> 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
>
> 

__________ 
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: