hi Mario; You could always add the Not IsKeyWaiting () condition to your while loop. This will terminate the loop as soon as you hit a key. In the final FindWindow, you should only specify one value in the arguments, You can specify "" (null string ) . for the class and the name for the window you are looking for. David Farough Application Accessibility Coordinator/coordonateur de l'accessibilité Information Technology Services Directorate / Direction des services d'information technologiques Public Service Commission / Commission de la fonction publique Email / Courriel: David.Farough@xxxxxxxxxxxxx Tel. / Tél: (613) 992-2779 >>> Mario Brusco <mrb620@xxxxxxxxxxx> 01:00 PM Monday, September 27, 2010 >>> Nope, still hangs. hmm, I'm wondering if there's a way to avoid the hanging without interfering the intended function of the script, sort of a safety out? I'm wary of forcing to turn off the PC (by holding the power button down until the PC shuts down (cold boot)) in order to get speech back; I've had to do this too many times. ----- Original Message ----- From: "Jackie McBride" <abletec@xxxxxxxxx> To: <jawsscripts@xxxxxxxxxxxxx> Sent: Monday, September 27, 2010 12:11 PM Subject: [jawsscripts] Re: dlgList of buttons Mario, let's revise the while loop, as follows: var String sList, ;will contain list of buttons String sItem, ;will contain the desired button name int iIndex, ;contains number of button selected handle hW ;contains window handles let hW= FindWindow (GetAppMainWindow (GetCurrentWindow ()), "Button", "") ;looks for a type (Button), starting from main window while (hW) ;while valid window handle found if GetWindowSubTypeCode (hW)== 1 then ;it's a button,gets name of button and adds it to the list, as well as the \007 item separator let sList= sList+GetWindowName (hW)+sep endIf ;let hW= GetNextWindow (hW) ;go to next window endWhile ;displays the list of buttons from which to pick, iIndex returns the button number let iIndex= dlgSelectItemInList (sList, "calculator buttons", 1) ;gets the name of the button selected let sItem= stringSegment (sList, sep, iIndex) let hW= FindWindow (GetAppMainWindow (GetCurrentWindow ()), "Button", sItem) if hW then ;valid window handle SetFocus(hw) TypeKey("space") else SayMessage (OT_MESSAGE, "window not found") endIf EndScript On 9/27/10, Mario Brusco <mrb620@xxxxxxxxxxx> wrote: > hi scripters, I am trying to adapt the following code to retrieve a list > of > the Windows calculator buttons whether it is in standard or scientific > mode, > whether the buttons are disabled or not. It seems to hang at some point. > can > someone please help to get it working for me? Maybe the problem is in the > while loop? I dabble lightly and am not a true scripter yet, so I need > actual code: > > const > sep = "\007" > > Script GetButton () > ;control+jawskey+b > ; gathers the buttons in a window into a list, user can use arrows to use > the arrow keys and enter key to select a function > ; works in any window/dialog > var > String sList, ;will contain list of buttons > String sItem, ;will contain the desired button name > int iIndex, ;contains number of button selected > handle hW ;contains window handles > let hW= FindWindow (GetAppMainWindow (GetCurrentWindow ()), "Button", "") > ;looks for a type (Button), starting from main window > while (hW) ;while valid window handle found > if GetWindowSubTypeCode (hW)== 1 then ;it's a button,gets name of button > and > adds it to the list, as well as the \007 item separator > let sList= sList+GetWindowName (hW)+sep > ;let hW= GetNextWindow (hW) ;go to next window > endIf > endWhile ;displays the list of buttons from which to pick, iIndex returns > the button number > let iIndex= dlgSelectItemInList (sList, "calculator buttons", 1) ;gets the > name of the button selected > let sItem= stringSegment (sList, sep, iIndex) > SaveCursor () > JAWSCursor () > RouteJAWSToPc ();finds the button & gets its handle > let hW= FindWindow (GetAppMainWindow (GetCurrentWindow ()), > "ThunderRT6CommandButton", sItem) > if hW then ;valid window handle > if MoveToWindow (hW) then ;move to the window whose handle u just got > LeftMouseButton () > Else > SayMessage (OT_MESSAGE, "cannot move to button") > endIf > else > SayMessage (OT_MESSAGE, "window not found") > endIf > RestoreCursor () > EndScript > > __________ > > View the list's information and change your settings at > //www.freelists.org/list/jawsscripts > > -- Change the world--1 deed at a time Jackie McBride Scripting Classes: http://jawsscripting.lonsdalemedia.org homePage: www.abletec.serverheaven.net For technophobes: www.technophoeb.com __________ 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 > This e-mail message is intended for the named recipient(s) and may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. Unauthorized disclosure, copying or re-transmission is prohibited. If you are not a named recipient or not authorized by the named recipient(s), or if you have received this e-mail in error, then please notify the sender immediately and delete the message and any copies. > Ce courriel est destiné exclusivement au destinataire mentionné en titre et peut contenir de l'information privilégiée, confidentielle ou soustraite à la communication aux termes des lois applicables. Toute divulgation non autorisée, toute reproduction ou réacheminement est interdit. Si vous n'êtes pas le destinataire de ce courriel, ou n'êtes pas autorisé par le destinataire visé, ou encore, si vous l'avez reçu par erreur, veuillez le mentionner immédiatement à l'expéditeur et supprimer le courriel et les copies. __________� View the list's information and change your settings at //www.freelists.org/list/jawsscripts