Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-26-2011, 07:12 PM
CREvans CREvans is online now
Registered User
 
Join Date: 03-10-2008
Location: Iowa
Posts: 28
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
Reply With Quote
  #2  
Old 05-26-2011, 11:05 PM
joe12 joe12 is online now
Registered User
 
Join Date: 05-26-2011
Posts: 8
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.
Reply With Quote
  #3  
Old 05-27-2011, 07:44 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
[vbld_FindProcess("winword")]

http://www.kinook.com/VisBuildPro/Ma...scriptmisc.htm
http://www.kinook.com/VisBuildPro/Ma...xpressions.htm
Reply With Quote
  #4  
Old 05-27-2011, 09:48 AM
CREvans CREvans is online now
Registered User
 
Join Date: 03-10-2008
Location: Iowa
Posts: 28
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)
Reply With Quote
  #5  
Old 05-27-2011, 10:19 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
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).
Attached Files
File Type: bld WaitWord.bld (462 Bytes, 1427 views)
Reply With Quote
  #6  
Old 05-27-2011, 10:28 AM
CREvans CREvans is online now
Registered User
 
Join Date: 03-10-2008
Location: Iowa
Posts: 28
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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 04:12 PM.


Copyright © 1999-2023 Kinook Software, Inc.