GetWindowHandle, nothing found doesn't set the result variable to 0

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 1021
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

GetWindowHandle, nothing found doesn't set the result variable to 0

Post by Grovkillen » Thu Dec 17, 2020 11:52 am

I need to set the window handle to zero before running the GetWindowHandle command just to be sure that the value isn't from a previous check. I would expect the command to return zero if nothing is found.

Code: Select all

Let>WINDOW_HANDLE=0
GetWindowHandle>Window Title*,WINDOW_HANDLE
Let>ME=%Script%

Running: 15.0.24
version history

User avatar
JRL
Automation Wizard
Posts: 3500
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: GetWindowHandle, nothing found doesn't set the result variable to 0

Post by JRL » Thu Dec 17, 2020 3:38 pm

Well... apparently if no window is found the result is not set to anything. Since window handles are always a number, rather than presetting the result value to "0" I'd set it to a text value perhaps "BLANK" or even "ZERO". After the GetWindowHandle> function if the result is still set to the preset text, you'll know that no window was found.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts