[jawsscripts] Re: Hello and Scripting Problem

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

Other related posts: