Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   How to wait until process exit if process number is not known (https://www.kinook.com/Forum/showthread.php?t=4867)

CREvans 05-26-2011 07:12 PM

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

joe12 05-26-2011 11:05 PM

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.

kinook 05-27-2011 07:44 AM

[vbld_FindProcess("winword")]

http://www.kinook.com/VisBuildPro/Ma...scriptmisc.htm
http://www.kinook.com/VisBuildPro/Ma...xpressions.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

1 Attachment(s)
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


All times are GMT -5. The time now is 08:33 AM.


Copyright © 1999-2023 Kinook Software, Inc.