Jump to content

ProcessExists


Recommended Posts

Hi.

I have Program that install silent. but after install, open Internet Explorer. I wrote this code for close web Browser but it don't work good always.

if ProcessExists ("iexplore.exe") Then
   ProcessClose ( "iexplore.exe" )

ElseIf ProcessExists ("opera.exe") Then
   ProcessClose ("opera.exe")

ElseIf ProcessExists ("chrome.exe") Then
   ProcessClose ("chrome.exe")
EndIf
Link to comment
Share on other sites

By using Elseif it will only execute one of your statements, if you have open both opera and chrome only opera will be closed. If you use one if for each case all 3 will be closed if more than one was open:

if ProcessExists ("iexplore.exe") Then ProcessClose ( "iexplore.exe" )

if ProcessExists ("opera.exe") Then ProcessClose ("opera.exe") 

if ProcessExists ("chrome.exe") Then ProcessClose ("chrome.exe")
Link to comment
Share on other sites

 

By using Elseif it will only execute one of your statements, if you have open both opera and chrome only opera will be closed. If you use one if for each case all 3 will be closed if more than one was open:

if ProcessExists ("iexplore.exe") Then ProcessClose ( "iexplore.exe" )

if ProcessExists ("opera.exe") Then ProcessClose ("opera.exe")

if ProcessExists ("chrome.exe") Then ProcessClose ("chrome.exe")

Thanks Geir1983.

 

This should close all of the instances:

 

 

While ProcessExists("iexplore.exe")

    ProcessClose("iexplore.exe")

    Sleep(100)

WEnd

 

Do the same for another browsers  :)

Thanks michaelslamet.

But show an error after close the Browser.

Error: Error parsing function call.

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...