A Forum reader recently asked:
“I found the new command “GetHandle” to be potentially very useful, as often you might want to interact with the parent window after the child window has closed. My question is, how do I use it?
For example, can I use the handle with SetFocus? Or Type? In other words, can I use it to interact with the controls of the parent (initial) window after I’ve closed the child window without messing around with Type /raw stuff?”
And here is the response from David Guest …
I’ve done some digging and it appears that you cannot use this with SetFocus. However, it could be used to verify that you have returned back to the initial dialog screen and so need to type in the UserID/Password/Optional fields again. This will need to be done with the /raw, but it does mean that you can verify that you are at the right screen/window so the ID/Password will not magically appear somewhere else.
So, you could try this:
Dialog Title "Log In" EndDialog GetHandle ?OriginalScreen Type $Username #1001 Type $Password #1002 Click #2 Dialog Title "Log In Failure" EndDialog DisplayVariables "Your ID and Password appear to be wrong." $Username $Password Click #2 GetHandle ?CurrentScreen If ?OriginalScreen eq ?CurrentScreen Type $Username -raw Type \T -raw Type $Password -raw Type \N -raw Else MessageBox "Please log in again with the correct ID" EndIf