|
|
Thread Tools | Rate Thread | Display Modes |
#1
|
|||
|
|||
How to wait until process exit if process number is not known
How would I configure the wait until process exit step to wait until a process has exited, if I don't know the process ID number, but only the name (winword.exe)? It appears as if this wait condition only takes a process ID as argument.
Thanks! Scott |
#2
|
|||
|
|||
Over here I found something that might work.
I used it like this to close an application.... Set objShell = CreateObject("WScript.Shell") If objShell.AppActivate("Document - WordPad") Then objShell.SendKeys "%%{F4}" ' send Alt+F4 (Exit for Wordpad Builder.LogMessage "- Found WordPad open on that document: Document and closed it! --"Else Builder.LogMessage "- WordPad is not currently open on that document: Document! --"End If But I think you can simply do a loop around the AppActivate call untiil the app is no longer active in a subsequent script step. Last edited by joe12; 05-26-2011 at 11:12 PM. |
#3
|
|||
|
|||
[vbld_FindProcess("winword")]
http://www.kinook.com/VisBuildPro/Ma...scriptmisc.htm http://www.kinook.com/VisBuildPro/Ma...xpressions.htm |
#4
|
|||
|
|||
How would I use that vbld_FindProcess function? I tried putting that into the wait step in the Process ID(s)" area and it failed, and when trying to put it into a vbscript piece as follows:
id = vbld_FindProcess("WINWORD") or id = vbld_FindProcess("WINWORD.EXE") both gave a type mismatch error. If I put it in brackets (i.e. id=[vbld_FindProcess("WINWORD")] it gave a null return, even though I have winword running. (same if I put it as WINWORD.EXE) |
#5
|
|||
|
|||
Which version of Visual Build are you running? Which version+SP of Windows and Word? When starting Word 2003, building the attached project in v7.7a on Win7, then closing Word, I get:
5/27/2011 9:17:05 AM: -------------------- Starting Build: 'WaitWord.bld' -------------------- 5/27/2011 9:17:05 AM: Building project step 1 - Project steps... 5/27/2011 9:17:05 AM: Building project step 2 - Wait... Waiting for process(es) '3908' to exit... All processes completed 5/27/2011 9:17:08 AM: Build successfully completed (elapsed = 00:00:03). |
#6
|
|||
|
|||
Oops, I was trying it on a machine I hadn't upgraded to a recent VBPro. Works fine when running a recent version. Sorry about that.
Scott |
|
|