[jawsscripts] Re: Hello and Scripting Problem

Since object-oriented programming is the wave of the future (mutter 
mutter) global variables have been shoved roughly aside to accomodate 
their step cousin "fields." Jaws scripting is stuck back in procedural 
city so global variables are still a good thing (I just forgot - CS 
professors sure are stubborn).

I agree programmers often like to tell you what is evil and what isn't 
(life would be so much easier if people were like computers and there 
was only one right or wrong answer to everything).

Sorry if I'm vearing too far off topic, but I figured now would be as 
good a time as any to test the limits in a non-obnoxious way (afterall, 
each list is different).

James

----- Original Message -----
From: Marlon Brandão de Sousa <splyt.lists@xxxxxxxxx>
Date: Friday, January 18, 2008 2:23 pm
Subject: [jawsscripts] Re: Hello and Scripting Problem
To: jawsscripts@xxxxxxxxxxxxx

> Well, global variables are usefull but when you're in a multi threaded
> enviroment, or when you have functions writting and retrieving values
> from global variables you have to take care.
> Jaws scripting is designed to solve only a subset of problems, from
> which, in my opinion, global variables are more usefull than
> dangerous, although even in scripting you can make logical mistakes
> when using global variables if you don't know what you're doing.
> In programming most part of people always try to teach things they
> like as great and things they don't like as horrible, but no feature
> are really bad if you know what you are doing and how to do it. Global
> variables might lead you to serious bugs in softwares in some
> sircunstanses, but this won't happen if you know exactly what you're
> doing.
> As students and even those experiensed programmers might have some
> errors, we try to avoid everything that could make it easier to have
> them ... and global variables are included in the groups of features
> that can lead one to some errors. But sure they help to solve many
> problems and, if used the correct way they can help a lot.
> hth
> Marlon
> 
> 2008/1/18, James Dietz <James.Dietz@xxxxxxxxxxx>:
> > Hey,
> >
> > Thanks a lot.  The script now works, and it's all thanks to global
> > variables.  (I'm in my college's CS program which has spent a 
> lot of
> > time convincing me that global variables are evil, but jaws 
> scripting> isn't very complex anyway).
> >
> > James
> >
> > ----- Original Message -----
> > From: Bryan Garaventa <bgaraventa11@xxxxxxxxxxxxxx>
> > Date: Friday, January 18, 2008 12:22 pm
> > Subject: [jawsscripts] Re: Hello and Scripting Problem
> > To: jawsscripts@xxxxxxxxxxxxx
> >
> > > If you are always switching to the image window from the text
> > > window, just
> > > write a statement before the control+tab script activates, which
> > > will save
> > > the current window handle to a global variable. You will just need
> > > to get
> > > the class for the current window, which would be the text window,
> > > to ensure
> > > that this is the right window when running.
> > >
> > > For instance,
> > >
> > > globals
> > > handle h_text_window
> > >
> > > ; Then add the following code to the beginning of the control+tab
> > > script...
> > > if GetWindowClass (GetFocus ()) == "TextWindowClassName" then
> > >
> > > let h_text_window = GetFocus ()
> > >
> > > endif
> > >
> > >
> > > ; Then when you want to switch back to the text window from the
> > > image
> > > window, you could use the following code within the top of the
> > > control+tab
> > > script...
> > >
> > > if GetWindowClass (GetFocus ()) == "ImageWindowClassName" then
> > >
> > > SetFocus(h_text_window)
> > > Return
> > > endif
> > >
> > > Hope this helps,
> > >
> > > Bryan
> > >
> > > ----- Original Message -----
> > > From: "James Dietz" <James.Dietz@xxxxxxxxxxx>
> > > To: <jawsscripts@xxxxxxxxxxxxx>
> > > Sent: Friday, January 18, 2008 8:04 AM
> > > Subject: [jawsscripts] Hello and Scripting Problem
> > >
> > >
> > > > Hey,
> > > >
> > > > Glad to be on the list (I think -- got an automated "subscribed"
> > > > message anyway); I haven't seriously tried Jaws scripting in
> > > years and
> > > > forgot how neat it was.  I'm trying to step up my scripting
> > > game, which
> > > > is why I joined this list etc etc.
> > > >
> > > > Anyway to business:
> > > > I'm writing a very simple script for a free OCR program called
> > > TopOCR> (topocr.com) which is a pretty good program with an
> > > annoying interface;
> > > > it seems to have two separate windows (one for the scanned 
> image and
> > > > one for the recognized text) which are not children of one main
> > > > window.  It's possible to switch between them using the utility
> > > > functions (homerow+tab and left click) and unrestricted Jaws
> > > Find but
> > > > I'm writing a script to do that at the press of a key
> > > (ctrl+tab).  I've
> > > > figured out how to switch from the text window to the image 
> window> > > (just SetFocus(GetNextWindow(GetForegroundWindow()))) 
> but not
> > > how to
> > > > switch back to the text window to read the OCRed 
> results/save to
> > > word> etc.  Using NVDA's incredibly useful object navigation
> > > feature (beats
> > > > the jaws utility functions in intuitiveness) I discovered 
> that I
> > > should> be able to switch to it by getting the prior window of the
> > > parent of
> > > > the focus but nothing happens.  My original plan was to 
> FindWindow> > > starting at the desktop
> > > > for the window with the text window's class, but a) there
> > > doesn't seem
> > > > to be an equivalent to the windows API's GetDesktopWindow 
> and b)
> > > 0 for
> > > > the handle parameter just gives me the app top level window 
> which> > > doesn't seem to work in this app (two separate windows 
> with the
> > > desktop> as their parent like I said).  Hopefully one of you will
> > > have a better
> > > > idea of what might work - I'm pretty new to scripting in general
> > > > afterall.  Of course if you need more info or if I wasn't clear
> > > enough> please let me know.
> > > >
> > > > Thanks a lot,
> > > > James
> > > > __________
> > > > View the list's information and change your settings at
> > > > http://www.freelists.org/list/jawsscripts
> > > >
> > >
> > > __________
> > > View the list's information and change your settings at
> > > http://www.freelists.org/list/jawsscripts
> > >
> > >
> > >
> > __________
> > View the list's information and change your settings at
> > http://www.freelists.org/list/jawsscripts
> >
> >
> 
> 
> -- 
> When you say "I wrote a program that crashed Windows," people just
> stare at you blankly and say "Hey, I got those with the system, for
> free."
> Linus Torvalds
> __________ 
> View the list's information and change your settings at 
> http://www.freelists.org/list/jawsscripts
> 
> 
>
__________ 
View the list's information and change your settings at
http://www.freelists.org/list/jawsscripts

Other related posts: