imagine

Waiting for in program process to finish

6 posts in this topic

#1 ·  Posted

Hi,

I am trying to automate a process where I am editing an stl file for 3D printing and I want to have a script that goes through each step in succession.  What I am trying to do is send a mouse click to a specific button, click that button, and then wait to the software to finish processing the command and then do another mouse click on another button and wait and repeat the whole cycle for several more times. The problem is the part where I want the script to wait until the software has finished processing it's command before clicking another button. I found an autoit command, ProcessWaitClose but don't know how to find the PID. I see that the example uses notepad.exe as the process parameter but is there a way to get the PID for a process that is happening within a software? Or is there a better way of doing this?

Share this post


Link to post
Share on other sites



#2 ·  Posted

I should probably try to clarify, I want the script to be able to identify when a specific task is done in the program before it moves onto the next step which is clicking another task button in the software.

Share this post


Link to post
Share on other sites

#3 ·  Posted

The process might be as follows...

Determine in words how you complete the process manually

Translate that into code methodically testing and debugging each stage as you go

The usual place to start is naming the program you want to automate, and checking if the window info tool can get information about its controls (buttons, labels and such)


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#4 ·  Posted

as you know ....

ProcessWaitClose("ProcessName.exe")

You can easily find process name from task manager process tab (Alt+Ctrl+del).There is no need of PID of you have process name.


Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I tried using ProcessWaitClose and the more I think about it, I get the feeling that that's probably not the best command for my process.

So I switched over to WinWaitClose but I am having a tough time understanding how to use the WinWaitClose command. My process involves executing a triangle reduction command in software and then a window with a progress bar pops up, and takes a variable amount of time to complete depending on the computers CPU capability. I'm not sure how to get my script to know that the progress bar is up and running so as to pause the whole script and then run the next mouseclick when the progress bar is gone.

I used the window info finder tool on the progress bar of the software when it was running and here's what I got.  The whole progress bar takes between 1-5 seconds to complete but varies considerably depending on the stl file size in use. Could I use the handle information in anyway? My code is just not working.

Title:    Progress [84%]
Class:    #32770
Position:    620, 419
Size:    441, 183
Style:    0x94C800CC
ExStyle:    0x00050101
Handle:    0x00000000003202A0

So far this is my code:

MouseClick ( "left", 169, 96, 1 ,0 ) 
Send("{Enter}")

WinWaitClose ("[hWnd: 0x00000000003202A0]")

MouseClick ( "left", 229, 97, 1 ,10 ) 
Send("{Enter}")

WinWaitClose ("[TITLE: Progress]")

MouseClick ( "left", 14, 97, 1 ,0 )

Edited by imagine

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Title:    Progress [84%].Progress [85%].Progress [86%]............  title is changing continuously So.........Using  WinGetTitle()  allow you to know the progress status.

Or Simply try like this......

For $n = 1% To 100%
WinWaitClose("Progress "&"["&$n&"]")

Because Title is changing..........

Edited by Starstar

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

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