Re: IS there any examples about title-match-mode-4 on "regexp=REGEXP"
p0etb0x <[email protected]>
| Newsgroups | gmane.comp.windows.autoit.user |
|---|---|
| Message-ID | <[email protected]> |
--- In [email protected], "valery_vi" <shehrer1@...> wrote: > > But I can't use Larry's new func ClassNNOfHWND(ByRef $hwnd) from > > http://www.autoitscript.com/forum/index.php?showtopic=17656 > > This useful (in future) func allows to extract any (?) classname from > windows handle. > > Opt("WinTitleMatchMode", 4) > > if WinExists('regexp=S(.*?)', '') then > $hWnd = WinGetHandle('regexp=S(.*?)', '') > Msgbox(0,'', 'Title = ' & WinGetTitle ($hWnd) & ' Text = ' & > WinGetText ($hWnd)) > Msgbox(0,'', 'ClassName = ' & ClassNNOfHWND($hWnd)) > else > Msgbox(0,'', 'is not') > return > endif > > ;Larry's func > Func ClassNNOfHWND(ByRef $hwnd) > Local $i,$ctrl, $phWnd > > $phWnd = DLLCall > ("user32.dll","hwnd","GetAncestor","hwnd",$hwnd,"int",2) > $phWnd = $phWnd[0] > If $phwnd = 0 Or $phWnd = $hwnd Then Return SetError(1,1,0) > > Local $list = WinGetClassList($phWnd) > > While StringLen($list) > $i = StringInStr($list,@lf) > $ctrl = StringLeft($list,$i-1) > $list = @lf & $list > $i = 1 > Do > If ControlGetHandle($phWnd,"",$ctrl & $i) = $hwnd Then > Return $ctrl & $i > $i += 1 > $list = StringReplace($list,@lf & $ctrl & @lf,@lf,1) > Until Not StringInStr($list,@lf & $ctrl & @lf) > $list = StringTrimLeft($list,1) > WEnd > Return SetError(1,0,0) > EndFunc > > > --- In [email protected], "valery_vi" <shehrer1@> wrote: > > > > Having handle ($hWnd) you can operate by windows without problems. > > > > --- In [email protected], "valery_vi" <shehrer1@> wrote: > > > > > > You are lucky man. > > > But there is method to get Title and Text of window founded in > this > > > exotic (by RegExp) case: > > > > > > Opt("WinTitleMatchMode", 4) > > > > > > if WinExists('regexp=S(.*?)', '') then > > > $hWnd = WinGetHandle('regexp=S(.*?)', '') > > > Msgbox(0,'', 'Title = ' & WinGetTitle ($hWnd) & ' Text = ' & > > > WinGetText ($hWnd)) > > > else > > > Msgbox(0,'', 'is not') > > > endif > > > > > > > > > > > > --- In [email protected], p0etb0x <no_reply@> wrote: > > > > > > > > --- In [email protected], "valery_vi" <shehrer1@> > wrote: > > > > > > > > > > > > > > > Opt("WinTitleMatchMode", 4) > > > > > > > > > > if WinExists('regexp=S(.*?)', '') then > > > > > Msgbox(0,'', 'win exists') > > > > > else > > > > > Msgbox(0,'', 'is not') > > > > > endif > > > > > > > > > > --- In [email protected], p0etb0x <no_reply@> wrote: > > > > > > > > > > > > thank you. > > > > > > > > > > > > > > > thank you very much.It seems that "regexp" cannot be used in > > > Winclose > > > > () > > > > To my surprise,I changed the replaced the letter 'S' in your > code > > > > with any other single letter,the result is the same "win > exists". > > > > > > > > > > Thank u very much.You're so friendly and so helpful.