Gavriels Posted October 18, 2022 Share Posted October 18, 2022 Hello when I send this script it doesn't react I think it's because of this character # but I don't know how to do it thank you for your help if WinActive ("[CLASS:ad_win#2]", "") Then MsgBox($MB_SYSTEMMODAL, "test", "Is Active.", 10) Link to comment Share on other sites More sharing options...
SkysLastChance Posted October 18, 2022 Share Posted October 18, 2022 Try this. WinActivate("[CLASS:ad_win#2]") If WinActive("[CLASS:ad_win#2]") Then MsgBox(0, "test", "Is Active.", 10) or If WinWaitActive("[CLASS:ad_win#2]") Then MsgBox(0, "test", "Is Active.", 10) If this doesn't work. Show a screen shot of Au3info screen. Life's simple. You make choices and you don't look back. Link to comment Share on other sites More sharing options...
Gavriels Posted October 18, 2022 Author Share Posted October 18, 2022 Link to comment Share on other sites More sharing options...
SkysLastChance Posted October 18, 2022 Share Posted October 18, 2022 If WinActive("AnyDesk") Then MsgBox(0, "test", "Is Active.", 10) ? Life's simple. You make choices and you don't look back. Link to comment Share on other sites More sharing options...
Gavriels Posted October 18, 2022 Author Share Posted October 18, 2022 I have several anydesk windows I need this specific [CLASS:ad_win#2] or[CLASS:ad_win#3] Link to comment Share on other sites More sharing options...
SkysLastChance Posted October 18, 2022 Share Posted October 18, 2022 Sorry, I have to go. I will check back tomorrow. Look into https://www.autoitscript.com/autoit3/docs/functions/WinGetHandle.htm Life's simple. You make choices and you don't look back. Link to comment Share on other sites More sharing options...
Gavriels Posted October 19, 2022 Author Share Posted October 19, 2022 This works Local $hWnd = WinGetHandle("[title:AnyDesk]") $a=_WinAPI_GetClassName($hwnd) If WinActive("[CLASS:"& $a &"]") Then MsgBox(0, "test", "Is Active.", 10) But this is not working Local $hWnd = WinGetHandle("[title:AnyDesk]") $a=_WinAPI_GetClassName($hwnd) IniWrite ( @ScriptDir & "\screen.ini", "Capture", "x1",$a) $m=IniRead ( @ScriptDir & "\screen.ini", "Capture", "x1", "") If WinActive("[CLASS:"& $m &"]") Then MsgBox(0, "test", "Is Active.", 10) I did not solve my problem Link to comment Share on other sites More sharing options...
Gavriels Posted October 19, 2022 Author Share Posted October 19, 2022 (edited) I found the function REGEXPCLASS But now the problem continues in ControlClick("[REGEXPCLASS:ad_win#3]", "", "basic_button#91") Edited October 19, 2022 by Gavriels Link to comment Share on other sites More sharing options...
SkysLastChance Posted October 19, 2022 Share Posted October 19, 2022 (edited) Just to clerify this works? If WinActive("[REGEXPCLASS:ad_win#3]") Then MsgBox(0, "test", "Is Active.", 10) Can you show a screen shot of the control tab when the button is selected? (Au3info screen) Edited October 19, 2022 by SkysLastChance Life's simple. You make choices and you don't look back. Link to comment Share on other sites More sharing options...
Gavriels Posted October 19, 2022 Author Share Posted October 19, 2022 Link to comment Share on other sites More sharing options...
SkysLastChance Posted October 19, 2022 Share Posted October 19, 2022 Probably not exactly what you need. However, this should get you on the right path at the very least. $Title = "AnyDesk" $ListAnyDesk = WinList($Title) For $i = 1 To $ListAnyDesk[0][0] $hwnd = $ListAnyDesk[$i][1] If $hwnd = WinActivate($Title) Then ControlClick($hwnd, "", "basic_button#91") EndIf Next Life's simple. You make choices and you don't look back. Link to comment Share on other sites More sharing options...
Gavriels Posted October 20, 2022 Author Share Posted October 20, 2022 (edited) #include <Array.au3> #include <WinAPIDlg.au3> #include <MsgBoxConstants.au3> Local $WinTitle ="[REGEXPCLASS:ad_win#3]" ; $aInfo = _CtrlInfo($WinTitle) ; Sort Array method WinActivate("[REGEXPCLASS:ad_win#3]") $a=$aInfo[27][0] $hnd="[REGEXPCLASS:ad_win#3]" ControlEnable ($hnd, "",$a) MsgBox($MB_TOPMOST, $aInfo[27][0], $a, 30) _ArrayDisplay($aInfo, "ArrayDisplay", "", 0, 8, "ClassnameNN") Func _CtrlInfo($WinTitle) Local $iCount = 0 $class = StringStripWS(WinGetClassList($WinTitle, ""), 2) ; $STR_STRIPTRAILING (2) = strip trailing white space $aClass = StringSplit($class, @LF, 2) ; $STR_NOCOUNT (2) = disable the return count in the first element - effectively makes the array 0-based. Local $aArray[UBound($aClass)][1] ; New 2D array. _ArraySort($aClass) For $i = 0 To UBound($aClass) - 1 $iCount = (($i = 0 Or $aClass[$i] == $aClass[$i - 1]) ? $iCount + 1 : 1) $aArray[$i][0] = $aClass[$i] & $iCount ; ClassnameNN Next Return $aArray EndFunc ;==>_CtrlInfo It chooses the ClassnameNN but it still doesn't work Edited October 20, 2022 by Gavriels Link to comment Share on other sites More sharing options...
Gavriels Posted October 21, 2022 Author Share Posted October 21, 2022 I tried mouseclick on this window the mouse cursor moves but it does not click me. is there another way to simulate mouse . Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now