behdadsoft Posted January 14, 2014 Posted January 14, 2014 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
michaelslamet Posted January 14, 2014 Posted January 14, 2014 What do you mean by "dont work good always"? Is it sometime doesn't close the browser? or close a wrong browser instance?
behdadsoft Posted January 14, 2014 Author Posted January 14, 2014 Quote 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.
Geir1983 Posted January 14, 2014 Posted January 14, 2014 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")
michaelslamet Posted January 14, 2014 Posted January 14, 2014 This should close all of the instances: While ProcessExists("iexplore.exe") ProcessClose("iexplore.exe") Sleep(100) WEnd Do the same for another browsers
behdadsoft Posted January 14, 2014 Author Posted January 14, 2014 Quote 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. Quote 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now