Sign in to follow this  
Followers 0
behdadsoft

ProcessExists

6 posts in this topic

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

Share this post


Link to post
Share on other sites



What do you mean by "dont work good always"? Is it sometime doesn't close the browser? or close a wrong browser instance?

Share this post


Link to post
Share on other sites

 

What do you mean by "dont work good always"? Is it sometime doesn't close the browser? or close a wrong browser instance?

it sometime doesn't close the browser.

Share this post


Link to post
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")

Share this post


Link to post
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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0