Sign in to follow this  
Followers 0
Sahensch

Getting AutoIT to wait

7 posts in this topic

I'm new to AutoIT, but NOT new to programming or computers. I'm attempting to automate and streamline a process at work. The process involves two propietary programs and a small batch file I wrote. My problem occurs when I try to get my script to wait at the end of running the first program before it runs my batch file. I'm stuck with using Windows 2000 Pro as this is the latest version that will run these propietary programs.

The script won't wait before running the batch file and until I can get that to happen, I'm stuck.

What am I missing?

I've read through all the forums but couldn't find anything that specifically applied to my situation. The help files were quite UN-helpful in this instance altough they help be get this far.

My Script is below:

ShellExecuteWait ("sys-init")

Sleep (21000)-------------------------------------------------------------> All the sleep statements are because I can't get the script to wait for an action to compete.

ShellExecute ("JOB LAUNCH")

Sleep (6500)

MouseClick ("left", 254, 133);Puts machine in Test Mode

MouseClick ("left", 270, 293);Moves mouse to Op ID text box

Send ("XXX") ;Enters three initials

MouseClick ("left", 228, 334);Turns off Serialize

MouseClick ("left", 445, 252);Choose Diag family

MouseClick ("left", 437, 534);Choose OCRCAL job

MouseClick ("left", 456, 670);Click on ZAP

Sleep (2000) ;Wait 2 seconds for ZAP window to open

Send ("93500") ; Enter cart number to delete

MouseClick ("left", 557, 372);Press ZAP

MouseClick ("left", 478, 436);Click Yes

MouseClick ("left", 517, 425);Click OK

MouseClick ("left", 669, 322);Close the ZAP window

MouseClick ("left", 275, 665);Start the Output Processor

MouseClick ("left", 136, 670);Click on Prepare

MouseClick ("left", 136, 670);Click on Run

MouseClick ("left", 473, 426);Click on OK in Test window

;Sleep (120000)

WinWaitClose ("c:\S9k\Jobs\TPC_CAL\tpc_cal.exe")

ShellExecuteWait ("o:\calcurve copy.bat")

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Sleep (2000) ;Wait 2 seconds for ZAP window to open

WinWaitActive("zap window title")

For window titles that change

Opt("WinTitleMatchMode", 2)
WinWaitActive("Part of Window title that stays the same")

OR

If WinExists("title of window") Then
"your statements go here

EDIT: Typo

Edited by 2words4uready

READ BEFORE POSTINGMy UDF'sMessagesYou say plz because its shorter than please. I say no because its shorter than yes.Join My Website

Share this post


Link to post
Share on other sites

Zedna and 2words4uready, Thanks for your fast replies. Unfortunately, neither really helped me, but you both did get my thinking clearer.

Here is my problem with some better explanation. My problem lies in the last two lines of my script. The second to last line; WinWaitClose ("c:\S9k\Jobs\TPC_CAL\tpc_cal.exe"), I'm asking the script to wait for this DOS windows to close before it executes the last line; ShellExecuteWait ("o:\calcurve copy.bat"), a small batch the does a copy and paste. The problem is that the copy and paste absolutely CANNOT be performed until the second to last line is closed, but the copy and paste don't wait for the WinWaitClose to happen. The ShellExecuteWait is not waiting for the WinWaitClose to close.

Share this post


Link to post
Share on other sites

Check what the Autoit V3 Window Info tool tells you about the window, it's probally going to be that the title of the window is something like C:\WINDOWS\system32\cmd.exe - c:\S9k\Jobs\TPC_CAL\tpc_cal.exe


Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Share this post


Link to post
Share on other sites

Kerros,

Nope, it says exactly what I have written in the script. Nothing of cmd.exe at all.

I'm beginning to think that these programs are SO proprietary, that they only superficially resemble a windows program. All the mouse clicking works just fine, but when I try to do anything with the window itself, PFFFT....no joy.

Share this post


Link to post
Share on other sites

Thank you all for your assisstance, but it seems that I am attempting to automate something that is so propietary that it only LOOKS like windows, but is not built on the Windows standard.

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
Sign in to follow this  
Followers 0