Jump to content

Check To See If Scripe Is Already Running


Recommended Posts

See AutoItSetTitle and AutoItGetTitle in the help file... Hmm, this could be improved...

Add this to the beginning of a script to prevent it from running a second instance:

If AutoItWinGetTitle() = "Some unique program title goes here" Then Exit
AutoItSetTitle("Some unique program title goes here")

Hope that helps

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

I think what roadrunner was asking, is if there is any way for a script to determine if another instance is already running in memory...

I've played around with ProcessExists(), AutoItWinGetTitle(), as well as other functions; but haven't had any luck checking if the compiled script is already running. I've also looked into using task manager (taskmgr.exe) to parse the list of open processes, but haven't had any luck with getting a usable screen-scrape.

Hopefully somebody knows of an easier way to obtain a list of processes currently in memory... :whistle:

Link to comment
Share on other sites

$g_szVersion = "My Script 1.1"
If WinExists($g_szVersion) Then Exit  ; It's already running
AutoItWinSetTitle($g_szVersion)

That names your script. The next time its run, if it finds that name, it will exit, otherwise, it must be the first instance, so it names itself.

Edited by Valik
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...