Jump to content

How to limit autoit executable file to only one instance running?


Recommended Posts

I am trying to figure out how to limit the user to running only *one* instance of the autoit program I created.

The problem is that they might have renamed the program to somethingelse.exe, so I can't just check the running processes.

The program "lives" in the system tray, and I can't seem to find any associated window...

Is there a way to easily do this? Maybe I can specifically "name" the program window, and then look for this window when starting the next instance.. then exit if it exists?

Thanks!

Link to comment
Share on other sites

Ah... I figured it out by using the "_Singleton()" function:

; Test to make sure there is not already an instance running.
if _Singleton($ProgramName, 1) = 0 Then
    Msgbox(64, $ProgramName, "The program is already running.")
    Exit
EndIf

Cheers!

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