Jump to content

Check for running applications before installing software


antmar904
 Share

Recommended Posts

Hi

I use AutoIT to deploy software.  In my installation scripts I usually look for certain running applications the user might have open like Internet Explore, Lotus Notes, Microsoft Word, etc.

Lately one of my installation scripts seems to be looping during a process hang and the installation script will terminate or not functions properly.

Let's say I am looking to see if Microsoft Word is running (winword.exe).

I would use:

While ProcessExists("winword.exe")
    MsgBox(0, "Adobe Acrobat Reader DC", "You must close Microsoft Word before proceeding!" & @CRLF & @CRLF & "Please save your work and close Microsoft Word and click [OK]", 30)
WEnd

If I wanted to check If Internet Explore was running:

While ProcessExists("iexplore.exe")
    MsgBox(0, "Adobe Acrobat Reader DC", "You must close Internet Explorer before proceeding!" & @CRLF & @CRLF & "Please save your work and close Internet Explorer and click [OK]", 30)
    ProcessClose("iexplore.exe")
WEnd

When the users closes the specific application in question, sometimes the applications process can hang or get stuck causing my installation script to sometimes fail or even loop.

I just wanted to know how others go about checking for running applications.

Here is a code snippet of how I would search for running applications before proceeding to the application installation:

While ProcessExists("nlnotes.exe")
    MsgBox(0, "Adobe Acrobat Reader DC", "You must close IBM NOTES before proceeding!" & @CRLF & @CRLF & "Please save your work and close IBM NOTES and click [OK]", 30)
WEnd

While ProcessExists("iexplore.exe")
    MsgBox(0, "Adobe Acrobat Reader DC", "You must close Internet Explorer before proceeding!" & @CRLF & @CRLF & "Please save your work and close Internet Explorer and click [OK]", 30)
    ProcessClose("iexplore.exe")
WEnd

While ProcessExists("winword.exe")
    MsgBox(0, "Adobe Acrobat Reader DC", "You must close Microsoft Word before proceeding!" & @CRLF & @CRLF & "Please save your work and close Microsoft Word and click [OK]", 30)
WEnd

While ProcessExists("excel.exe")
    MsgBox(0, "Adobe Acrobat Reader DC", "You must close Microsoft Excel before proceeding!" & @CRLF & @CRLF & "Please save your work and close Microsoft Excel and click [OK]", 30)
WEnd

While ProcessExists("powerpnt.exe")
    MsgBox(0, "Adobe Acrobat Reader DC", "You must close Microsoft PowerPoint before proceeding!" & @CRLF & @CRLF & "Please save your work and close Microsoft PowerPoint and click [OK]", 30)
WEnd

While ProcessExists("msaccess.exe")
    MsgBox(0, "Adobe Acrobat Reader DC", "You must close Microsoft Access before proceeding!" & @CRLF & @CRLF & "Please save your work and close Microsoft Access and click [OK]", 30)
WEnd

While ProcessExists("AcroRd32.exe")
    MsgBox(0, "Adobe Acrobat Reader DC", "You must close Adobe Reader or Adobe Acrobat before proceeding!" & @CRLF & @CRLF & "Please save your work and close Adobe Reader or Adobe Acrobat and click [OK]", 30)
WEnd

 

Link to comment
Share on other sites

  • Moderators

For interactive installs I follow what you see in most commercial software - I prompt with a "retry" button three times and then fail gracefully. Put the onus on the end user to ensure the processes are closed, rather than killing processes through your install script.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...