Make VB script subroutine to check process

Hello to all VB Guru's

I'm trying to make a vb script (.vbs) subroutine that will:

Continually check if a process (.exe) is running
Once it's done running (finished), then launch another program (.exe).
Everything I've tried to far, doesn't work.

Really appreacate all your assistance!

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
front my point of view, vb script is not naturally designed for the use to run constantly at background.

why not to design a service program that running at background for such process detection? you can write that service program in .NET/ JAVA or other favourite or programming language you're familiar with.
Lee W, MVPTechnology and Business Process AdvisorCommented:
You haven't enumerated "everything" that you've tried so I have no idea why it's not working for you or what you're trying to use to check it.

Here's a function.
You could put a loop in place with a sleep option and check it once per second.  (I would NOT run it as just a continuous loop WITHOUT putting a reasonable delay)
TECHSANTAAuthor Commented:
Thank you for the your help.

It doesn't have to be a function or subroutine per say, just a way for the VB script to run in the background and continually check if a process is running. When that .exe stops, then run another .exe.

That function you sent looked okay, but I couldn't get it to work properly on a loop.

Any ideas?

Thank you for your assistance!

Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

Lee W, MVPTechnology and Business Process AdvisorCommented:
Can you post the code you tried to use in the loop?

A BASIC loop might look like this:

Do While IsProcessRunning("SomeProcess.exe") = True
'When the process is NOT running, the above loop exits and the script continues:
TECHSANTAAuthor Commented:
This is what I have:

Do While isProcessRunning(strComputer,strProcess) = True
      WshShell.Run "C:\Windows\Software\adobe.exe"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Lee W, MVPTechnology and Business Process AdvisorCommented:
So what is not working?  Debug.

Add WScript.Echo comments and run from cscript to see what's going on (running by double click or WSCRIPT with an echo could be tedious).
TECHSANTAAuthor Commented:
Not bad
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.