etidd Posted September 20, 2023 Posted September 20, 2023 (edited) Hello to all my friends that live inside of my computer! I'm still having trouble getting a click sent to a specific control. In this case, it is a file inside of a file explorer pane. I'm assuming I can target actual files and just about anything that comes up in UIASpy or Control Viewer. I can easily achieve the click I want with MouseClick() with accurate coordinates, but I think it is best to avoid specific coordinates should the screen resolution or window size be different at runtime. I tried using ControlClick() with the following parameters: WinWait("Music") WinMove("[ACTIVE]", "", 999, 320) MouseWheel($MOUSE_WHEEL_DOWN, 10) ; scrolling down to the bottom of the window so the target file is in view **Working** Sleep(2000) ControlClick("Music", "", 11, "left") ; not working! ControlClick("Music", "", "[ID:11]", "left") ; not working! ControlClick("Music", "", 31812, "left") ; not working! ControlClick("Music", "", "[ID:31812]", "left") ; not working! I gave it 2 seconds to allow for timing. I also tried using the constant $MOUSE_CLICK_LEFT. Here is the control information that I found on the target in UIASpy. Still having trouble finding out how to use ControlClick(). Any thoughts? Edited September 20, 2023 by etidd
BigDaddyO Posted September 21, 2023 Posted September 21, 2023 your mixing up the UIA Automation and the built in commands. Use the AU3info to get the control that you want to use the controlclick on. If that doesn't show the control info, then you need to use UIA to perform the click [ .Invoke() or .Select() ] depending on the control
etidd Posted September 21, 2023 Author Posted September 21, 2023 (edited) I downloaded a previous version of AU3Info that doesn't crash. Still, the control information is the same. This command works, but it doesn't target the desired control (a specific file in the window): ControlClick("Music", "", "[CLASS:DirectUIHWND; INSTANCE:3]", $MOUSE_CLICK_LEFT) That control appears to be the most specific AutoIt can target in file explorer. It cannot target specific files. I did some reading in previous threads here. I think what I'm stating is correct that specific files cannot be targeted for clicks by AU3 pre-defined functions. Now, I will try to learn about .Invoke() and .Select() using the UIA properties. Do you have a sample on how either of these functions are used? This whole errand may not be worthwhile. I can click within the desired region. Then, I can just send some down arrow keystrokes. Edited September 21, 2023 by etidd
etidd Posted September 22, 2023 Author Posted September 22, 2023 Here's the sample code from UIASpy. Can anything be done with this? ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, "11", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) Local $pListItem1, $oListItem1 $oParent.FindFirst( $TreeScope_Descendants, $pCondition0, $pListItem1 ) $oListItem1 = ObjCreateInterface( $pListItem1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oListItem1 ) Then Return ConsoleWrite( "$oListItem1 ERR" & @CRLF ) ConsoleWrite( "$oListItem1 OK" & @CRLF ) $oParent is undefined here.
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