SkiFreak Posted September 28, 2006 Share Posted September 28, 2006 Is there a way to have the application (a compiled AutoIt script) detect if it already running? Using ProcessExists is not an option as it will always detect itself when started. I need to be able to ensure that there is only ever one instance of the application running at any one time. A bit more info: As might have been seen from my previous post, I am running a continuous loop and checking for changes in a file. There is no "window" that I can check for, the only thing that identifies that the application is running is that there is a tray icon. Is this possible? Link to comment Share on other sites More sharing options...
Helge Posted September 28, 2006 Share Posted September 28, 2006 Voila ! Link to comment Share on other sites More sharing options...
SkiFreak Posted September 28, 2006 Author Share Posted September 28, 2006 Voila !Seek and ye shall find (sometimes).Next time I guess that I will have to look a little bit harder.Thanks for showing me the light at the end of the tunnel... Link to comment Share on other sites More sharing options...
JOHNe Posted October 4, 2006 Share Posted October 4, 2006 Is there a way to have the application (a compiled AutoIt script) detect if it already running? Using ProcessExists is not an option as it will always detect itself when started. I need to be able to ensure that there is only ever one instance of the application running at any one time. A bit more info: As might have been seen from my previous post, I am running a continuous loop and checking for changes in a file. There is no "window" that I can check for, the only thing that identifies that the application is running is that there is a tray icon. Is this possible? Hello ..have you looked at Singleton :"> ;Singleton - To check to see that App runs once only #include <Misc.au3> Singleton("123456789");Create a unique value Func Singleton($semaphore) Local $ERROR_ALREADY_EXISTS = 183 DllCall("kernel32.dll", "int", "CreateSemaphore", "int", 0, "long", 1, "long", 1, "str", $semaphore) Local $lastError = DllCall("kernel32.dll", "int", "GetLastError") If $lastError[0] = $ERROR_ALREADY_EXISTS Then MsgBox(48, "What again....??", "The software is already running.... Dummy!! ");Error message Exit -1 EndIf EndFunc ;Singleton end "Our deepest fear is not that we are inadequate.Our deepest fear is that we are powerful beyond measure.It is our light, not our darkness that most frightens us." Link to comment Share on other sites More sharing options...
Cookie Posted October 9, 2006 Share Posted October 9, 2006 (edited) This works for me If WinExist("Program_name") MsgBox(0, "Error", "Program already running") Exit Endif GuiCreate("Progam_name",100,100) Program_name is the name where you create the gui with Edited October 9, 2006 by Cookie Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 9, 2006 Moderators Share Posted October 9, 2006 This works for meIf WinExist("Program_name") MsgBox(0, "Error", "Program already running") ExitEndifGuiCreate("Progam_name",100,100)Program_name is the name where you create the gui withIf the end-user changes your .exe name to something common, you'll run into an issue there. _SingleTon() is probably the best option here. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
this-is-me Posted October 12, 2006 Share Posted October 12, 2006 If the end-user changes your .exe name to something common, you'll run into an issue there. _SingleTon() is probably the best option here.... as opposed to a _TwoTon() function ... Who else would I be? Link to comment Share on other sites More sharing options...
JSThePatriot Posted October 13, 2006 Share Posted October 13, 2006 ... as opposed to a _TwoTon() function ...Wouldnt that be _DoubleTon()? JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
this-is-me Posted October 13, 2006 Share Posted October 13, 2006 Arrrrgh... Yes it would. Who else would I be? Link to comment Share on other sites More sharing options...
JSThePatriot Posted October 13, 2006 Share Posted October 13, 2006 Arrrrgh... Yes it would.hehe... but I generally pun the same way JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 13, 2006 Share Posted October 13, 2006 Why not use the AutoIt window? Set it in a way that no other window could possibly do the same thing. Something like "fhvhjbhdsbcjkndhvbhjvggahkhdhfbrhvbh"? Just use the window AutoIt always makes if your script has none. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now