Jump to content

Duplicate Processes?


toonboon
 Share

Recommended Posts

With ProcessExists() I can check whether a process exists.. but I know the process exists. I need to know whether it exists twice :(

I'll try ProcessList though :mellow: thanks for the tip.

(NO I'm not closing the process and then running ProcessExists() to see whether the process is still there xD)

[right]~What can I say, I'm a Simplistic person[/right]

Link to comment
Share on other sites

;Run("notepad.exe"); testing with notepad
;Run("notepad.exe")
$name = InputBox("enter process name", "enter", "notepad.exe")
$list = ProcessList($name)
for $i = 1 to $list[0][0]
    For $t = 1 to $list[0][0]
        If $list[$t][0] = $list[$i][0] And $list[$t][1] <> $list[$i][1] then;checks if there is proccess with SAME name but with DIFFERENT PID.
            MsgBox(0, "process exists twice OR more:", $list[$t][0] & " - PID: " & $list[$t][1] & @CRLF & $list[$i][0] & " - PID: " & $list[$i][1])
        EndIf
    Next
next

try this, i think it will help

if u want to close the most new process - close this one with the higher PID, and if for the first started - the lower PID (i think)

Edited by cheatera

Is There A Life BEFORE Death?im stupidSaved warn logs: cheateraSmOke_N Note Added 17 January 2009 - 02:54 PM Added to warn level Posting a way to hack the registry and force sending someones desktop via TCP. Jos Note Added 25 November 2008 - 02:52 PM Added to warn level for being an impolite rookie.once a year i go bad ... what will happen in 2010??[u]Its GOOD to be BAD ... (Warlock's Succubus - World of Warcraft)[/u]

Link to comment
Share on other sites

$name = InputBox("enter process name", "enter", "notepad.exe")
$amount = Processlist($name)
While $amount[0][0]>1
ProcessClose($name)
$amount = Processlist($name)
WEnd

MsgBox(0,"1 left","the is now only one process left of notepad.exe")

I prefer my coding, I think it's a bit simpler.

EDIT: typo

Edited by toonboon

[right]~What can I say, I'm a Simplistic person[/right]

Link to comment
Share on other sites

what about 3 processes? or u are sure there are only 2? i mean in my example it shows all processes (2,3, ... 55 ... ) but yes yours it simplier :mellow: btw just checked: the most rescent open process is with the higher PID, so if u want to close the most rescent - kill the process with higher PID.

cheerz

Is There A Life BEFORE Death?im stupidSaved warn logs: cheateraSmOke_N Note Added 17 January 2009 - 02:54 PM Added to warn level Posting a way to hack the registry and force sending someones desktop via TCP. Jos Note Added 25 November 2008 - 02:52 PM Added to warn level for being an impolite rookie.once a year i go bad ... what will happen in 2010??[u]Its GOOD to be BAD ... (Warlock's Succubus - World of Warcraft)[/u]

Link to comment
Share on other sites

there can also be 1000 processes, but my script kills each and every one untill only one remains. so that's what I need.

I don't think it matters whether I close the older or the newer.. but I'll check.

[right]~What can I say, I'm a Simplistic person[/right]

Link to comment
Share on other sites

  • 2 weeks later...
  • Moderators

sorry to hijack this thread (it seems u've already found a solution) but what is this function that detects whether the script itself is already running?

Look for _Singleton in the help file.

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.

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