Luli Posted April 22, 2024 Posted April 22, 2024 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. 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
Andreik Posted April 22, 2024 Posted April 22, 2024 (edited) Try this: $hWin = WinWait('Teradata SQL Assistant') If IsHWnd($hWin) Then ControlClick($hWin, '', '[REGEXPCLASS:(?i)WindowsForms\d+\.Window\.\d+\.app\.\d+\.[a-z0-9_]+_ad1; INSTANCE:30]') Edited April 22, 2024 by Andreik
Nine Posted April 23, 2024 Posted April 23, 2024 (edited) 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 April 23, 2024 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
water Posted April 23, 2024 Posted April 23, 2024 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 2024-07-28 - Version 1.6.3.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 (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
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