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