WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: mcjathan on February 12, 2016, 03:45:07 PM

Title: Use RoboScripter Output When Window Name is Too Generic
Post by: mcjathan on February 12, 2016, 03:45:07 PM
Greetings,  Please consider this RoboScripter output:

Quote
;RoboScripter
; Made with
;   RoboScripter ver: 45
;   CtlMgr ver: 44039
AddExtender("wwctl44i.dll")

;Title: WinFax PRO
;ID: 0
;Class: #32770
;Level: 1

; Default cWndByWndSpec seems OK here
ControlHandle=cWndByWndSpec("#32770","csrss",2,2,65535)
; ControlHandle=cWndByWndSpecName("WinFax PRO","csrss",2,2,65535)
; ControlHandle=DllHwnd('WinFax PRO')
WinWaitExist("WinFax PRO", -1 )  ;Wait for window to exist ;TODO Check title and timeout value

I want to be able to detect and then close the window.  However, the "WinFax PRO" window name is too generic in my case -- I detect too many irrelevant windows.  So, is there a way I can convert the ControlHandle to a variable that can be used in the function WinWaitExist?  Something like this?

Quote
ControlHandle=cWndByWndSpec("#32770","csrss",2,2,65535)
Win1 = SomeWinbatchFunction(ControlHandle)
WinWaitExist(Win1, -1)
Title: Re: Use RoboScripter Output When Window Name is Too Generic
Post by: td on February 12, 2016, 04:58:01 PM
See cWinIdConvert in the Consolidated WIL Help file.  Most  functions that take window names will also take window Ids.  The function converts a window handle to a window id.
Title: Re: Use RoboScripter Output When Window Name is Too Generic
Post by: mcjathan on February 13, 2016, 07:24:22 AM
Thank you!