Jump to content

Recommended Posts

Posted

How can this code be modified to allow only one instance of Iexplorer to Run.

While 1

If ProcessExists('IExplorer.exe') Then

Do

ProcessClose('IExplorer.exe')

Until Not ProcessExists('IExplorer.exe')

EndIf

Sleep(10)

WEnd

Thank you

  • Moderators
Posted

Do you know the PID of the one you want to keep? If so gafrosts suggestion would be fine. If not, you'll never know which one you are killing.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

This is what I got so far

#NoTrayIcon

While 1

$list = ProcessList('IExplorer.exe')

$1 = "IExplorer.exe"

If $list [0][0] > 1 Then

ProcessClose('IExplorer.exe')

EndIf

Sleep(10)

WEnd

So far it works. Do you see anything that can be improved?

if not thank you for your input.

  • Moderators
Posted (edited)

So you don't care which instance of IE is closed, just that there is always one?

@Mandar

Yes, don't define $1. It's not used.

#NoTrayIcon

While 1
$list = ProcessList('IExplorer.exe')
If $list [0][0] > 1 Then
ProcessClose('IExplorer.exe')
EndIf
Sleep(10)
WEndoÝ÷ Ûú®¢×ºÚ"µÍÚ[HBYPÝ[
ØÙÜÓÝ
    ÌÎNÒQ^Ü^IÌÎNÊJHHH    ÝÈH[ØÙÜÐÛÜÙJ   ÌÎNÒQ^Ü^IÌÎNÊBÛY
L
BÑ[
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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
×
×
  • Create New...