Farhan Posted February 6 Share Posted February 6 (edited) I've recently developed a MongoDB PSM connector and fortunately it's working perfectly. However, I've encountered a challenge that I'm seeking your expertise to overcome. When attempting to run the AutoIT tool after opening the MongoDB Compass Client, it only captures the title of the application. The 'Finder Tool' is unable to capture the input parameters and the button. Despite my attempts with mouse coordinates (x and y axis) on my 14-inch laptop, I'm concerned about the issues when using larger screens like 18 or 24 inches. (Currently on 14 inch it's working perfect) Tried using mouse coordinates on my 14-inch laptop but I'm worried about variations with larger screens (say 18 inch or 24 inch screen) How shall I handle this? If AutoIT can't catch the user input box, I'm stuck. If AutoIT can't capture the user input box, the connector will definitely open but crash Any assistance or guidance you can provide in resolving this matter would be greatly appreciated. Thank you in advance for your support. PFA Attachment for your reference. Edited March 14 by Farhan Sensitive Info Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 6 Moderators Share Posted February 6 If you're going to use your script in different environments, then I'd suggest not using fixed coordinates. Use WinGetPos since you're waiting for it to load anyway, and base your coords off of that. That way the coords are always relative to the DB window. Although it's confusing why you're taking this type of approach with Send() and Mouseclick() I'll leave that alone. I'll also be moving this to the proper forum. You're working with an external GUI not using or creating an AutoIt GUI Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
argumentum Posted February 6 Share Posted February 6 1) MouseClick("left", $clX, $clY) Nope, use MouseClick("primary", $clX, $clY). These left handed people exist. 2) Find the window position then add the client positon, that way the screen size or the main window position will not be a problem. 3) Welcome to the forum Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
argumentum Posted February 6 Share Posted February 6 4) be aware of HiDPI monitors and scaling. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Farhan Posted February 11 Author Share Posted February 11 @argumentum/ @SmOke_N i created this manually bcz in MongoDB Compass GUI, AutoIT is unable to find Window inside MongoDB Compass. The only way i found is by Send or MouseClick. I would appreciate if you can help me creating it in much sufficient way. Link to comment Share on other sites More sharing options...
argumentum Posted February 11 Share Posted February 11 11 hours ago, Farhan said: ...bcz in MongoDB Compass GUI... I'd love to install MongoDB and this "MongoDB Compass" and go at it, just for you. Is nothing I haven't done in the past for other threads. Unfortunately, I have some hurdles to overcome in my own projects and can't devote the time and focus to jump in to answer/code it. I can't help you right now. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Farhan Posted March 14 Author Share Posted March 14 Hey ppl, Appreciate your response but the problem started 🥺 Since AutoIT WindowsInfoTool cannot find elements from MongoGB Compass GUI, I have used mouse coordinates, unfortunately people are using 18" - 32" LEDs to complete their activity on database. Mouse coordinates on 32" screen goes somewhere else and press control A🥹, i feel so bad while testing🥹 What else apart from Mouse Coordinates can be used? I tried using controlclick but I didn't find control ID/element ID .. please help find a solution to it.. Link to comment Share on other sites More sharing options...
ioa747 Posted March 14 Share Posted March 14 https://www.autoitscript.com/forum/topic/196833-uiaspy-ui-automation-spy-tool/ I know that I know nothing Link to comment Share on other sites More sharing options...
Farhan Posted March 14 Author Share Posted March 14 @ioa747, i have used UIA as well, no luck 😕 MongoDB Compass won't let you scan anything, i don't understand why is that so. I will have to find a perfect co-ordinate and click .. help anybody, if we could connect and troubleshoot Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 14 Moderators Share Posted March 14 expandcollapse popup#include <WinAPISysWin.au3> #include <Array.au3> ; $gvPID is for your integer Process ID or your exe name Global $gvPID = StringRegExpReplace(@AutoItExe, "^(.*?\\)*(.+?$)", "$2") Global $gaWinInfo = _WinGetByPID($gvPID) _ArrayDisplay($gaWinInfo) Func _WinGetByPID($vPID) $vPID = ProcessExists($vPID) If $vPID = 0 Then Return SetError(1, 0, 0) EndIf Local $aWList = WinList() ; [n][0] = Title ; [n][1] = Window Handle ; [n][2] = Class ; [n][3] = State ; [n][4] = Parent ; [n][5] = PID Local $aRet[UBound($aWList)][6] Local $iEnum = 0 For $i = 1 To UBound($aWList) - 1 If WinGetProcess($aWList[$i][1]) = $vPID Then $aRet[$iEnum][0] = $aWList[$i][0] $aRet[$iEnum][1] = $aWList[$i][1] $aRet[$iEnum][2] = _WinAPI_GetClassName($aWList[$i][1]) $aRet[$iEnum][3] = WinGetState($aWList[$i][1]) $aRet[$iEnum][4] = _WinAPI_GetParent($aWList[$i][1]) $aRet[$iEnum][5] = $vPID $iEnum += 1 EndIf Next If $iEnum = 0 Then Return SetError(2, 0, 0) EndIf ReDim $aRet[$iEnum][6] Return $aRet EndFunc If you run that with your mongodb.exe name, do any windows show up? Show a screen shot so we can see all the details of the windows found. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Farhan Posted March 17 Author Share Posted March 17 On 3/15/2024 at 12:42 AM, SmOke_N said: expandcollapse popup#include <WinAPISysWin.au3> #include <Array.au3> ; $gvPID is for your integer Process ID or your exe name Global $gvPID = StringRegExpReplace(@AutoItExe, "^(.*?\\)*(.+?$)", "$2") Global $gaWinInfo = _WinGetByPID($gvPID) _ArrayDisplay($gaWinInfo) Func _WinGetByPID($vPID) $vPID = ProcessExists($vPID) If $vPID = 0 Then Return SetError(1, 0, 0) EndIf Local $aWList = WinList() ; [n][0] = Title ; [n][1] = Window Handle ; [n][2] = Class ; [n][3] = State ; [n][4] = Parent ; [n][5] = PID Local $aRet[UBound($aWList)][6] Local $iEnum = 0 For $i = 1 To UBound($aWList) - 1 If WinGetProcess($aWList[$i][1]) = $vPID Then $aRet[$iEnum][0] = $aWList[$i][0] $aRet[$iEnum][1] = $aWList[$i][1] $aRet[$iEnum][2] = _WinAPI_GetClassName($aWList[$i][1]) $aRet[$iEnum][3] = WinGetState($aWList[$i][1]) $aRet[$iEnum][4] = _WinAPI_GetParent($aWList[$i][1]) $aRet[$iEnum][5] = $vPID $iEnum += 1 EndIf Next If $iEnum = 0 Then Return SetError(2, 0, 0) EndIf ReDim $aRet[$iEnum][6] Return $aRet EndFunc If you run that with your mongodb.exe name, do any windows show up? Show a screen shot so we can see all the details of the windows found Hey @SmOke_N, I understand your question, could you please elaborate on where shall I run this command? The issue I'm facing is with Mongodb Compass GUI windows client. I fixed my mouse click coordinates but it messes up due to resolution.. can we schedule a 30 mins virtual meet for better understanding? SmOke_N and Werty 1 1 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 17 Moderators Share Posted March 17 (edited) Look in your task manager. Find the executable name that is running for your mongodb. Save that script I have there into a separate .au3 file. Replace @AuotItExe with the mongodb executable name or PID from task manager. Run the script, take a screen shot, post it here. Edited March 17 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Farhan Posted March 17 Author Share Posted March 17 (edited) Hard Luck @SmOke_N, all other Exe's are running but not with MongoDBCompass, getting the same error while replacing it with PID.. Edited March 17 by Farhan Link to comment Share on other sites More sharing options...
argumentum Posted March 17 Share Posted March 17 (edited) encapsulate that like, "@thisString" oops Edited March 17 by argumentum oops Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 17 Moderators Share Posted March 17 expandcollapse popup#include <WinAPISysWin.au3> #include <Array.au3> ; $gvPID is for your integer Process ID or your exe name ;- Global $gvPID = StringRegExpReplace(@AutoItExe, "^(.*?\\)*(.+?$)", "$2") Global $gvPID = "MongoDBCompass.exe" Global $gaWinInfo = _WinGetByPID($gvPID) _ArrayDisplay($gaWinInfo) Func _WinGetByPID($vPID) $vPID = ProcessExists($vPID) If $vPID = 0 Then Return SetError(1, 0, 0) EndIf Local $aWList = WinList() ; [n][0] = Title ; [n][1] = Window Handle ; [n][2] = Class ; [n][3] = State ; [n][4] = Parent ; [n][5] = PID Local $aRet[UBound($aWList)][6] Local $iEnum = 0 For $i = 1 To UBound($aWList) - 1 If WinGetProcess($aWList[$i][1]) = $vPID Then $aRet[$iEnum][0] = $aWList[$i][0] $aRet[$iEnum][1] = $aWList[$i][1] $aRet[$iEnum][2] = _WinAPI_GetClassName($aWList[$i][1]) $aRet[$iEnum][3] = WinGetState($aWList[$i][1]) $aRet[$iEnum][4] = _WinAPI_GetParent($aWList[$i][1]) $aRet[$iEnum][5] = $vPID $iEnum += 1 EndIf Next If $iEnum = 0 Then Return SetError(2, 0, 0) EndIf ReDim $aRet[$iEnum][6] Return $aRet EndFunc 😑 argumentum 1 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Farhan Posted March 17 Author Share Posted March 17 (edited) @SmOke_N, I'm Sorryy . PFA --- didnt understand this probably my 1st time for ArrayDisplay but wont let you down next time. Edited March 17 by Farhan Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 17 Moderators Share Posted March 17 You can use WinGetPos("Chrome_WidgetWin_1"), Check the Opt("MouseCoordMode") options as well. WinGetPos will get the position of the window regardless of monitor size, dpi settings, etc if you're going to use MouseClick(). The issue(s) you will run into is the size of the window in different evironments, some may have it maximized, some may not. You'll need to do some math functions to compensate for the actual position you want to click. If the thing you're looking for is moving around, I would probably try to use UIAutomation, spend a few days trying to learn it. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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