Jump to content
Sign in to follow this  
sandyd

Allow only once instance of a script

Recommended Posts

sandyd

Hi All,

is there any easy way to allow only once instance of my script at any one time.

I know I can do this with a gui app by setting the title, but is there any way for a non-gui script.


----[ SandyD ]---

Share this post


Link to post
Share on other sites
Blue_Drache

Hi All,

is there any easy way to allow only once instance of my script at any one time.

I know I can do this with a gui app by setting the title, but is there any way for a non-gui script.

<{POST_SNAPBACK}>

It's in the help file, question 14 of the FAQ:

CODE

14. How can I make sure only one copy of my script is run?

The easiest way is to rename the title of the hidden AutoIt window when your script first starts.

Then in the same script check for that window title existing - if it does then another

copy of the script is running.

; Place at the top of your script

$g_szVersion = "My Script 1.1"

If WinExists($g_szVersion) Then Exit ; It's already running

AutoItWinSetTitle($g_szVersion)

; Rest of your script goes here

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites
sandyd

Ohhh, Just my luck, search the forums then find out its in the FAQ.

Thanks for the info though.

I'll just go and give myself a slap now :idiot:


----[ SandyD ]---

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.