Jump to content

Exit if not @AutoItPID


rcmaehl
 Share

Recommended Posts

Hi all,

I'm pretty sure this is once again me being absolutely dumb and missing something obvious. I need to ProcessClose() other instances of a script. I'm attempting to do so by comparing @AutoItPID to ProcessList() but the application kills itself.

My current code is as follows and I've tried on both stable and latest beta.

#include <Array.au3>

If Not @Compiled Then
    MsgBox(0, "", "Compile before testing...")
    Exit
EndIf

$aPIDs = ProcessList(@ScriptName)
_ArrayDisplay($aPIDs, @AutoItPID)
For $iLoop = 1 To $aPIDs[0][0] Step 1
    If $aPIDs[$iLoop][0] = @AutoItPID Then
        ;;;
    ElseIf Number($aPIDs[$iLoop][0]) = @AutoItPID Then
        ;;;
    ElseIf $aPIDs[$iLoop][0] = Number(@AutoItPID) Then
        ;;;
    ElseIf Number($aPIDs[$iLoop][0]) = Number(@AutoItPID) Then
        ;;;
    Else
        MsgBox(0, "Closing", $aPIDs[$iLoop][0])
        ProcessClose($aPIDs[$iLoop][0])
    EndIf
    MsgBox(0, "", $iLoop)
Next
$aPIDs = ProcessList(@ScriptName)
_ArrayDisplay($aPIDs)
MsgBox(0, "", "We will never get here")
Exit

Can anyone point me in the right direction?

I should invest in a rubber duck. Found the issue.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
Share on other sites

Just now, bobomb said:

Isnt it this?

If $aPIDs[$iLoop][1] = @AutoItPID Then

for process #?

YEPPPPPPPPP. 🤦‍♂️

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

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