Jump to content

Read Win is still running


 Share

Recommended Posts

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

Link to comment
Share on other sites

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

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
Link to comment
Share on other sites

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

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)

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

 

Link to comment
Share on other sites

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