Jump to content

MongoDB Compass GUI Connector for CyberArk PSM


Recommended Posts

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 by Farhan
Sensitive Info
Link to comment
Share on other sites

  • Moderators

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

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.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

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.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • 1 month later...

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

@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

  • Moderators
#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

On 3/15/2024 at 12:42 AM, SmOke_N said:
#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?

 

Link to comment
Share on other sites

  • Moderators
Posted (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 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

  • Moderators
#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

😑

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

  • Moderators

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...