Jump to content

Unable to click element in Teradata SQL Assistant


Recommended Posts

I need the script to launch a connection with the Teradata SQL Assistant and to do so it must be able to click on the area I marked in red.
image.thumb.png.1e8c26c18943a65938ab739956eed279.png
Even the debug mode isn't helping because it says that everything is executed successfully but the new window is not opening. 

A copy of my script:

ConsoleWrite("Waiting for Teradata SQL Assistant window..." & @CRLF)
Local $hWnd = WinWait("Teradata SQL Assistant", "", 10)

; Check if the window handle was obtained successfully
If $hWnd Then
    ConsoleWrite("Teradata SQL Assistant window found." & @CRLF)

    ; Get the handle of the main window
    $hWnd = WinGetHandle("Teradata SQL Assistant")

    ; Check if the main window handle is valid
    If $hWnd Then
        ConsoleWrite("Activating Teradata SQL Assistant window..." & @CRLF)
        ; Activate the Teradata SQL Assistant window
        WinActivate($hWnd)
        WinWaitActive($hWnd)

        ; Find and click the toolbar area to start a connection
        ConsoleWrite("Finding toolbar area..." & @CRLF)
        Local $hToolbar = ControlGetHandle($hWnd, "", "[NAME:_MainWnd_Toolbars_Dock_Area_Top]")

        ; Check if the toolbar control handle was obtained successfully
        If $hToolbar Then
            ConsoleWrite("Toolbar area found. Clicking..." & @CRLF)
            ; Click on the toolbar area (adjust the coordinates as needed)
            ControlClick($hWnd, "", $hToolbar, "left", 1, 25, 65)
        Else
            ConsoleWrite("Error: Failed to find the toolbar area." & @CRLF)
            MsgBox(16, "Error", "Failed to find the toolbar area.")
        EndIf
    Else
        ConsoleWrite("Error: Failed to get the handle of the main window." & @CRLF)
        MsgBox(16, "Error", "Failed to get the handle of the main window.")
    EndIf
Else
    ConsoleWrite("Error: Teradata SQL Assistant window not found." & @CRLF)
    MsgBox(16, "Error", "Teradata SQL Assistant window not found.")
EndIf

Link to comment
Share on other sites

1- make sure you are on the same CPU architecture (x86 or x64) : script and teradata

2- try using #RequireAdmin

3- ensure teradata has focus

4- try with UIAutomation

5- resort to use MouseClick (no big deal if [ACTIVE])

Edited by Nine
Link to comment
Share on other sites

You are sure that automating the Teradata SQL Assistant GUI is the best way to do what you want to do (btw. what do you want to achieve with your script)?
You can use ODBC from AutoIt to access the database etc. etc.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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