My software I'm attempting to automate includes a Button that can be present any number of times, but only one will be visible at a time. I was hoping something like this would work $hApplication = "MyApplication" $giWebWorkList_ButtonAddToWorklist = 4642 ; The ID of the controls $iLoop = 1 While True $hAddToWorklist = ControlGetHandle($hApplication, "", "[CLASSNN:Button" & $iLoop & "; ID:" & $giWebWorkList_ButtonAddToWorklist & "]") If Not IsHWnd($hAddToWorklist) Then