px Posted June 8, 2015 Share Posted June 8, 2015 Hi EveryoneI am running a simulation program that will generate a window. This window constantly generate output lines that give the timestep of the simulation is at. Once the simulation end, no more output line will be generated. Hence, at this point I would like to identify this window has stop generating output line and I would like to close this window. Is there a way to identify it ? Thank you in advanced. This has been bothering me for the past few days. Thank you. PX Link to comment Share on other sites More sharing options...
water Posted June 8, 2015 Share Posted June 8, 2015 Welcome to AutoIt and the forum!The answer is: It depends.Have you tried the AutoIt Window Info Tool to get information about this window?Can you post the AutoIt code you have tried so far? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
px Posted June 8, 2015 Author Share Posted June 8, 2015 (edited) Hi WaterI do not have any code related to this part. I attempted using WinActive, but it was not suitable for this purpose. Thank you and looking forward for your advice.The second pictures show that my simulation has terminated and I wish to identify it automatically using AutoITPX Edited June 8, 2015 by px Link to comment Share on other sites More sharing options...
water Posted June 8, 2015 Share Posted June 8, 2015 As this is a console application you could grab the output from StdOut and wait until the "Press any key" message appears and send a keypress to the application or window.BTW: As I see "ahk_class" in your screenshot, do you want to code in AutoHotKey (AHK) or AutoIt? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
px Posted June 9, 2015 Author Share Posted June 9, 2015 Hi WaterI am using AutoIT. When I am using AutoIt Window Info , it crashes sometime, hence I used Windowspy from Autohotkey at times.I see that to grab output using Stdout, most example show codes as below. However, in my window, the black screen : "C:\Program Files\ANSYS Inc\v140\CommonFiles\TCL\bin\intel\wish.exe", is not open using "Run" command, hence I cannot assign "Local $foo" to using in "StdoutRead"m to reads its content. This Window is generated when I start my simulation job. I am not sure which function in AutoIt is able to read it. Do you have any advice for me again ?? Thank you for the helpPX%%%%%%%%%%%%%%%%%Local $foo = Run(@ComSpec & " /c dir foo.bar", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)Local $lineWhile 1$line = StdoutRead($foo) %%%%%%%%%%%%%%%%% Link to comment Share on other sites More sharing options...
water Posted June 9, 2015 Share Posted June 9, 2015 I tried the following script to connect to an already running DOS window, but was not successful:#include <StringConstants.au3> Global $sTitle = "C:\Windows\system32\cmd.exe" If WinExists($sTitle) Then ConsoleWrite("Exists!" & @CRLF) $iPID = WinGetProcess($sTitle) ConsoleWrite($iPID & @CRLF) While 1 $sLine = StdoutRead($iPID) If @error Then MsgBox(0, "Error", @error) ExitLoop EndIf If StringStripWS($sLine, BitOR($STR_STRIPLEADING, $STR_STRIPTRAILING)) <> "" Then ConsoleWrite($sLine & @CRLF) Sleep(10) WEnd EndIfPlus I haven't found anything on the forum how to connect to the output stream of an already running application.Couldn't you start the application in your script using "Run"? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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