[jawsscripts] Re: An interesting scripting problem

  • From: "Jim Snowbarger" <Snowman@xxxxxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Tue, 8 May 2012 20:50:24 -0500

Yep,  this is usually my practice too.  Its the keyword, usually, that seems 
to be my problem.  maybe I'm half artist.

Likewise, when I compose in if statement,  I have gotten mostly in the habit 
of  putting the endIf a couple lines below it, so I don't forget it.
The other thing I do about EndIf, which was more important before I 
developed my if, endIf, matching utility in my scrip tmanager scripts, is to 
put a comment on the EndIf that tells me basically what the if statement was 
about.    Granted, I might populate the block with else's, or elif's later. 
But, it keeps from getting inscrutibel compile errors from forgotten endIfs. 
They can be a bitch to find.
Indentation helps too, of course, if your into dots.
In fact, I use this comment, especially if the if statement is complex.  I 
like the comment to distill the essence of the If statement down to shirt 
sleeve english for me, and I'll even copy it to the line right after the If 
statement.
Here's an admittedly  retarded example of what I do, and how I like to 
spread complex If clauses over multiple lines:

if (   (TimeIsAfterTen)
    && (DogIsInside)
    && (TeethBrushed)) then
  ; Ready For Bed
  ... Multiple lines of Statements required to
  actually get myself in the sack
Endif  ;  Ready for bed

The thing I find handy about that construct, is that, when I come back to 
this in a year, I don't have to puzzle out all the conditions and what they 
must mean.  The comment gives me the basics.








----- Original Message ----- 
From: "Jackie McBride" <abletec@xxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Monday, May 07, 2012 10:30 PM
Subject: [jawsscripts] Re: An interesting scripting problem


I do somethin kinda weird, I guess, but it has really helped me a lot.
Immediately after a while statement, b4 putting any conditions, etc.,
I press enter twice, put my incrementor, then an endwhile. I always
also put an endif immediately after every if statement. I find it
eliminates a great many errors. I actually teach that in my scripting
course, because it's 1 of the tricks that's taken me awhile to figure
out (I'm not the sharpest tool in the shed), & I was hoping it'd help
my students not to have to go thru as many errors as I did b4 I
finally at least got a little smarter.

Hopefully some of yall on this list will find it helpful as well,
though I suspect most of u are a lot sharper than I & have probly
already figured it out.

On 5/7/12, Soronel Haetir <soronel.haetir@xxxxxxxxx> wrote:
> Note that the desktop window with a handle of 0 is the root desktop
> window, it's what is  present if explorer dies (or is killed).  The
> usually visible desktop window is the shell desktop window.  I know
> there's a windows API to get that too, but I'm not sure if  jaws
> script mirrors it, and I'm too lazy to go look.
>
> On 5/7/12, Don Marang <donald.marang@xxxxxxxxx> wrote:
>> The Desktop has a window handle of 0.  If you look at the window
>> hierarchy, the Desktop is at the root of the entire window tree of
>> handles.  Therefore, starting a window handle search starting with 0
>> searches through all handles from all applications.
>> *Don Marang*
>> Vinux Package Development Coordinator - vinuxproject.org
>> <http://www.vinuxproject.org/>
>>
>>
>> On 5/7/2012 12:13 PM, Steve Matzura wrote:
>>> I'm not sure, but I went another route (see other messages with better
>>> script solution).
>>>
>>> On Sun, 6 May 2012 19:59:51 -0500, you wrote:
>>>
>>>> A start handle of 0?  That won't work, will it?
>>>> Don't you need to have a valid handle of some ancestor?
>>>>
>>>> ----- Original Message -----
>>>> From: "Steve Matzura" <number6@xxxxxxxxxxxxxx>
>>>> To: "jawsscripts" <jawsscripts@xxxxxxxxxxxxx>
>>>> Sent: Sunday, May 06, 2012 9:34 AM
>>>> Subject: [jawsscripts] An interesting scripting problem
>>>>
>>>>
>>>> I'm scripting an application that has a window that's sometimes there,
>>>> sometimes not. The first order of business is to check if the window
>>>> is there, and if it is, set focus to it. I know the control ID of the
>>>> window, 1019. I'm trying to use FindDescendantWindow with a start
>>>> handle of 0 to verify its existence. My script so far looks like this:
>>>>
>>>> Script ReadSearchStatus ()
>>>>
>>>> var handle hwin
>>>>
>>>> let hwin = FindDescendantWindow (0, 1019)
>>>>
>>>> if hwin > 0
>>>> then
>>>> Say ("search window present.", ot_jaws_message, false)
>>>>
>>>> ; Insert code to set focus to the window. Should I even bother
>>>> ; with this?
>>>> ; Should I just try setting focus and if it fails, assume the window's
>>>> ; not present?
>>>>
>>>> else
>>>> Say ("search window is not present.", ot_jaws_message, false)
>>>>
>>>> endif
>>>>
>>>> EndScript
>>>>
>>>> The problem is, it always comes up saying the window is present, even
>>>> when it's not.
>>>> __________�
>>>>
>>>> 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
>>>>
>>> __________�
>>>
>>> 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
>>
>>
>
>
> --
> Soronel Haetir
> soronel.haetir@xxxxxxxxx
> __________�
>
> View the list's information and change your settings at
> //www.freelists.org/list/jawsscripts
>
>


-- 
Blame the computer--why not? It can't defend itself & occasionally
might even be the culprit
Jackie McBride
Ask Me Computer Questions at: www.pcinquirer.com
Jaws Scripting training materials: www.screenreaderscripting.com
homePage: www.abletec.serverheaven.net
__________�

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: