Omatsei Posted October 30, 2006 Share Posted October 30, 2006 Is it possible to run a program, and wait only until the program is completely loaded, but not until the program closes? I'm checking to see if a window exists, and if not, start the program (Outlook in this case)... then a few lines later, go into the address book, but the script runs too fast and Outlook doesn't get a chance to fully open. Link to comment Share on other sites More sharing options...
Valuater Posted October 30, 2006 Share Posted October 30, 2006 Run() WinWaitAcrive() 8) Link to comment Share on other sites More sharing options...
theguy0000 Posted October 30, 2006 Share Posted October 30, 2006 Run()WinWaitAcrive()8)I would useRun ()WinWait ()which actually does wait only until the program is loaded, but not necesarily the front window The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
moocher Posted October 30, 2006 Share Posted October 30, 2006 Having same problem i use sleep But i think you can use some kinda wait for an object to exist if the object exists and then continue.. but havent found something usefull yet Link to comment Share on other sites More sharing options...
Valuater Posted October 30, 2006 Share Posted October 30, 2006 I would useRun ()WinWait ()which actually does wait only until the program is loaded, but not necesarily the front window I have found "at times" that is not a "long" enough wait to start sending info to a window8) Link to comment Share on other sites More sharing options...
Omatsei Posted October 30, 2006 Author Share Posted October 30, 2006 I've tried WinWait and WinWaitActive... and neither of them seem to wait until Outlook gets done doing whatever it does when it starts. It starts, then immediately switches to the other program I started (Eudora, in this case). I tried just telling it to sleep for 5 seconds, which works, but it just seems kinda inelegant. Link to comment Share on other sites More sharing options...
GaryFrost Posted October 30, 2006 Share Posted October 30, 2006 I've tried WinWait and WinWaitActive... and neither of them seem to wait until Outlook gets done doing whatever it does when it starts. It starts, then immediately switches to the other program I started (Eudora, in this case). I tried just telling it to sleep for 5 seconds, which works, but it just seems kinda inelegant.Sometimes inelegant is the only way. SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference.  Link to comment Share on other sites More sharing options...
Valuater Posted October 30, 2006 Share Posted October 30, 2006 (edited) I've tried WinWait and WinWaitActive... and neither of them seem to wait until Outlook gets done doing whatever it does when it starts. It starts, then immediately switches to the other program I started (Eudora, in this case). I tried just telling it to sleep for 5 seconds, which works, but it just seems kinda inelegant.if sleep for 5 seconds works... then it maybe the best approachyou could also try a loop with winwaitactive for Endura, but that may even be more inelegant.8) Edited October 30, 2006 by Valuater Link to comment Share on other sites More sharing options...
Omatsei Posted October 30, 2006 Author Share Posted October 30, 2006 I settled on using the sleep method. It's ugly, but it gets the job done (so far). Link to comment Share on other sites More sharing options...
Locodarwin Posted October 30, 2006 Share Posted October 30, 2006 (edited) I settled on using the sleep method. It's ugly, but it gets the job done (so far).A more elegant approach would be to automate Outlook using COM instead of keystrokes and mouse clicks. You are more certain to get precisely the data you want without a lot of key & click trial and error. I can't begin to tell you how much time I wasted in the early days trying to time and judge keystrokes, wait on windows, and click on buttons - only to have to start over when some unforseen change in the application's behavior or data came up. COM allows you to work directly with just about every MS Office application minus OneNote, I believe.It takes more effort to learn, but once you get it, you'll never go back to keystrokin'. It's well worth it.I'm not sure if anyone has written a comprehensive library that covers what you're looking to do (i.e. fiddle with contacts), but I don't think your project would be difficult to script with COM.Are you familiar with COM programming in other languages?Here's a link to Microsoft's Outlook automation help front-end:MS Outlook Automation-S Edited October 30, 2006 by Locodarwin (Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent] Link to comment Share on other sites More sharing options...
Valik Posted October 31, 2006 Share Posted October 31, 2006 The WaitForInputeIdle() function should accomplish that. It will require using DllCall() on OpenProcess(), CloseHandle() and the aforementioned WaitForInputIdle() function since AutoIt doesn't expose any of those. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now