Jump to content
Sign in to follow this  

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

Share this post

Link to post
Share on other sites

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.