Jump to content
px

Read Win is still running

Recommended Posts

px

Hi Everyone

I 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

Share this post


Link to post
Share on other sites
water

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 (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
px

Hi Water

I 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 AutoIT

PX

 

 

1.jpg

2.jpg

Edited by px

Share this post


Link to post
Share on other sites
water

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 (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
px

Hi Water

I 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 help

PX

%%%%%%%%%%%%%%%%%

Local $foo = Run(@ComSpec & " /c dir foo.bar", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
Local $line
While 1
$line = StdoutRead($foo)

%%%%%%%%%%%%%%%%%

 

Share this post


Link to post
Share on other sites
water

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
EndIf

Plus 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 (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
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

×