Jump to content
Sign in to follow this  
DaLiMan

Check for second startup

Recommended Posts

Hi there,

Does anyone have a good idea for checking if a script isn't started for a second time while the other is still running?

I thought I could do it with ProcessExists, but obviously this is alway true for it is his own process....

Dim $Versie = "3.4.0.4"
Dim $VersiePrcsChk = StringReplace($Versie,".","")

If ProcessExists("cqrinvuller" & $VersiePrcsChk & ".exe") Then
   MsgBox(0, "Error", "Error text")
EndIf

Please help...

Share this post


Link to post
Share on other sites

This is from FAQ, will this do?

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

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...