View Full Version : How to wait until process exit if process number is not known
CREvans
05-26-2011, 07:12 PM
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
joe12
05-26-2011, 11:05 PM
Over here (http://www.kinook.com/Forum/showthread.php?t=53)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.
kinook
05-27-2011, 07:44 AM
[vbld_FindProcess("winword")]
http://www.kinook.com/VisBuildPro/Manual/sysscriptmisc.htm
http://www.kinook.com/VisBuildPro/Manual/scriptexpressions.htm
CREvans
05-27-2011, 09:48 AM
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)
kinook
05-27-2011, 10:19 AM
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).
CREvans
05-27-2011, 10:28 AM
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
vBulletin® v3.8.11, Copyright ©2000-2024, vBulletin Solutions Inc.