Fr000m Posted April 16, 2019 Share Posted April 16, 2019 Hello everyone, new to autoit. I have a window that shares a common name with several others. I need to search it for a specific string, and click "ok". So far, I have this: Global $s_title_of_popup = "WINDOW NAME" Global $s_msgbox_class = "#32770" While 1 WinWait("[Title:" & $s_title_of_popup ["$sText"] & "Class:" & $s_msgbox_class & "]") ControlClick("[Title:" & $s_title_of_popup ["$sText"] & "Class:" & $s_msgbox_class & "]", "", "Button1") WEnd This works well at replying with OK to any window by that name. I need to add a third global variable, which is the content of text from the window. I tried this: Global $s_title_of_popup = "WINDOW NAME" Global $s_msgbox_class = "#32770" Global $sText = WinGetText ("WINDOW NAME" ["SPECIFIC STRING"]) While 1 WinWait("[Title:" & $s_title_of_popup ["$sText"] & "Class:" & $s_msgbox_class & "]") ControlClick("[Title:" & $s_title_of_popup ["$sText"] & "Class:" & $s_msgbox_class & "]", "", "Button1") WEnd Unfortunately this does not run (at all), it errors out line 3. Error: Subscript used on non-accesible variable. I am sure I've done something obvious, but I've tried a few things and can't get it right, so I'll post here for help. What I need to do is: run a .exe in the background (most likely as a service) have that .exe constantky looking for a popup window if the popup window contains a specific string, click ok Link to comment Share on other sites More sharing options...
jdelaney Posted April 16, 2019 Share Posted April 16, 2019 I can't fix all your errors on mobile, but don't use brackets it you don't declare arrays IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Nine Posted April 16, 2019 Share Posted April 16, 2019 I wouldn't use variables like you do to get access to a window. It is very hard to read, and it is useless, since you will refer to them only once, at the first Win* () function. Because after that statement, you should use the window handle provided by the Win* () function. Local $hWnd = WinWait ("[TITLE: something; CLASS:#32770]") ControlClick ($hWnd, "", "Button1") Don't you think it is clearer ? Fr000m 1 “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 Link to comment Share on other sites More sharing options...
Fr000m Posted April 16, 2019 Author Share Posted April 16, 2019 Hey all, ty. Nine, that's very clean, thank you. I just need to add a second condition, in addition to title. The condition needs to be matching a string in the body of the popup. Therefore: While 1 Local $hWnd = WinWait (Title: something; need to find specific string also Class:#32770]") ControlClick (hWnd, "", Button1")WEnd Appreciate all the help! Link to comment Share on other sites More sharing options...
Fr000m Posted April 16, 2019 Author Share Posted April 16, 2019 Missed a $ in there, second line, can't figure out how to edit the post. Link to comment Share on other sites More sharing options...
Nine Posted April 16, 2019 Share Posted April 16, 2019 You can specify text at the second parameter of the WinWait () “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 Link to comment Share on other sites More sharing options...
Fr000m Posted April 16, 2019 Author Share Posted April 16, 2019 Ah ok, thank you, I will give it a try! Link to comment Share on other sites More sharing options...
Fr000m Posted April 16, 2019 Author Share Posted April 16, 2019 So far, no luck. This is my current code: While 1 Local $hWnd = WinWait ("[TITLE: titleofwindow , textofwindow; CLASS:#32770]") ControlClick ($hWnd, "", "Button1") WEnd Probably not doing something abundantly obvious again. It does execute without errors, but it's not accomplishing the objective. Link to comment Share on other sites More sharing options...
Fr000m Posted April 16, 2019 Author Share Posted April 16, 2019 Every time I try to structure as dictated by the paremeters of winwait, it highlights the first [, as a syntax error. WinWait ( "title" [, "text" [, timeout = 0]] ) Should this be: Winwait ("windowtitle" [, "windowtext") ? Link to comment Share on other sites More sharing options...
Nine Posted April 16, 2019 Share Posted April 16, 2019 no it is for documention those brackets. It means it is an optional parameter...remove the brackets and place the text into double quotes “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 Link to comment Share on other sites More sharing options...
Fr000m Posted April 16, 2019 Author Share Posted April 16, 2019 I cannot get this to work, I just get unable to parse line. The syntax of autoit is....frustrating. While 1 Local $hWnd = WinWait ("WINDOWTITLE" "WINDOWTEXT" CLASS:#32770) ControlClick ($hWnd, "", "Button1") WEnd The unable to parse line error is focused on the # Link to comment Share on other sites More sharing options...
Nine Posted April 16, 2019 Share Posted April 16, 2019 Local $hWnd = WinWait ("[TITLE: something; CLASS:#32770]", "Text you are searching for") ControlClick ($hWnd, "", "Button1") Copy/paste those 2 lines and only replace the title and the text. “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 Link to comment Share on other sites More sharing options...
Fr000m Posted April 16, 2019 Author Share Posted April 16, 2019 Thanks, tried it, does nothing. The popup remains un-acknowledged. While 1 Local $hWnd = WinWait ("[TITLE: windowname; CLASS:#32770]", "specific string") ControlClick ($hWnd, "", "Button1") WEnd Link to comment Share on other sites More sharing options...
Nine Posted April 16, 2019 Share Posted April 16, 2019 (edited) Show au3info.exe of the popup. Show screen capture of the popup. Replace real name and real text. Edited April 16, 2019 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 Link to comment Share on other sites More sharing options...
Fr000m Posted April 16, 2019 Author Share Posted April 16, 2019 I did, which is how I got the title and the visible text. Link to comment Share on other sites More sharing options...
Nine Posted April 16, 2019 Share Posted April 16, 2019 post info in here “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 Link to comment Share on other sites More sharing options...
Fr000m Posted April 16, 2019 Author Share Posted April 16, 2019 >>>> Window <<<< Title: DeltaV Logon Class: #32770 Position: 298, 264 Size: 429, 200 Style: 0x94C801C5 ExStyle: 0x00010101 Handle: 0x001A0738 >>>> Control <<<< Class: Instance: ClassnameNN: Name: Advanced (Class): ID: Text: Position: Size: ControlClick Coords: Style: ExStyle: Handle: >>>> Mouse <<<< Position: 409, 292 Cursor ID: 0 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< OK PROVOX Logon failure! Reason: Failed logon attempt, the user name does not exist Please use the PROVOX Logon utility to try again. DeltaV Logon was successful. >>>> Hidden Text <<<< Link to comment Share on other sites More sharing options...
Fr000m Posted April 16, 2019 Author Share Posted April 16, 2019 I am using the window name "DeltaV Logon" and the text "PROVOX Logon failure!" There are other windows with the title "DeltaV Logon" that I do not want to do anything to, hence my desire to also use specific text from the message. Link to comment Share on other sites More sharing options...
Nine Posted April 16, 2019 Share Posted April 16, 2019 (edited) post button au3info in here, put a msgbox (0,"",$hWnd) after WinWait so we can see if it gets the window or not, post screen capture of popup in here Edited April 16, 2019 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 Link to comment Share on other sites More sharing options...
Fr000m Posted April 16, 2019 Author Share Posted April 16, 2019 I pasted the info from au3info, from the summary tab. Could you clarify what you mean? Also, can't get it to parse. While 1 Local $hWnd = WinWait msgbox(0,"",$hWnd) ;("[TITLE: DeltaV Logon; CLASS:#32770]", "PROVOX Logon failure")) ControlClick($hWnd, "", "Button1") WEnd I am terrible with autoit syntax. 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