Determine Window name or class resulting from a Run

Started by fhammer, April 01, 2019, 11:28:00 AM

Previous topic - Next topic

fhammer

I'm writing a script which Runs programs, based on program names (with paths, as needed) in a data file.
The script doesn't know the names or types of the programs prior to execution.

However, when I Run a program (using information from the data file), I'm looking for a way to wait until the program starts, then determine the name or class of the resulting main window.


td

 You can use RunShell with the @GETPROCID  flag and the WinItemProcId function to obtain a list of  Window IDs or titles associated with the process (application.)     Once you have the name you can use it to do things like call the WinShow function to restore a window to its "normal" state. Keep in mind the WinShow can't force a window to restore.  It all depends on how the program displaying the window is written.

The Consolidated WIL Help file is your friend and you can find more about the function mentioned above there.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

fhammer

Thanks td,

My first try didn't work. The RunShell returned a ProcID, but the WinItemProcID (executed immediately after the RunShell) did not return anything. I found that by adding a TimeDelay(3) in between the RunShell and WinItemProcID, I got the desired result.

Given that I have the ProcID, is there a way to replace the TimeDelay with something more determinate. I suppose I could put the  WinItemProcID in a loop, until something appears?

Thanks again.



td

It kinda depends on the process but to start, check out AppExist in the Consolidated WIL Help file.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

Almost forgot to mention the WinWaitExist function as another alternative.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade