Jump to content

How to detect if window is a file or a folder


Recommended Posts

I want the script to check if there are any other copies of it running at the moment.

; Load all windows into a variable
    $winlist = WinList()
; Check each window to see if it is an instance of MyScript
    $count = 0
    For $a = 1 to $winlist[0][0]
        If StringLeft($winlist[$a][0], 8) = "MyScript" Then 
            $count = $count + 1
        EndIf
    Next
All well and good, but the code detects both the window "MyScript.exe" and the folder where it lives, "MyScript", when the folder is open. This is potentially bad.

What's the procedure for checking if a window is a folder, or not?

Link to comment
Share on other sites

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