Knight Posted March 5, 2006 Share Posted March 5, 2006 It seems simple enough, and I have no idea how I haven't figured it out. I must be missing something big I need to check if the script is already running after compilation. In other words, I don't want duplicate scripts (compiled) running at the same time. Link to comment Share on other sites More sharing options...
Valuater Posted March 5, 2006 Share Posted March 5, 2006 Maybe If UBound(ProcessList(@ScriptName)) > 2 Then MsgBox(262208, "* NOTE * ", "Welcome to AutoIt 1-2-3 was already running ", 5) Exit EndIf 8) Link to comment Share on other sites More sharing options...
Knight Posted March 5, 2006 Author Share Posted March 5, 2006 (edited) Thank you very much! Never would of thought of that lol.. I did however, make this tiny change If UBound(ProcessList(@ScriptName)) > 2 Then WinActivate($Window) Exit EndIf Edited March 5, 2006 by Knight Link to comment Share on other sites More sharing options...
Valuater Posted March 5, 2006 Share Posted March 5, 2006 Welcome i like your addition too! 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 5, 2006 Moderators Share Posted March 5, 2006 If you have Beta, you can use _Singleton() in your files... .au3 / .a3x / or .exe (check out the Beta helpfile) 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...
Valuater Posted March 5, 2006 Share Posted March 5, 2006 If you have Beta, you can use _Singleton() in your files... .au3 / .a3x / or .exe (check out the Beta helpfile)I have seen that... but with the includes its just short of 400 lines of code added rather than the 4 above( unless you are going to use the Misc.au3 include for one of the other Functions )8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 5, 2006 Moderators Share Posted March 5, 2006 Not so many... I just put the function in manually... SingleRun('Make my own title for this semaphore') Func SingleRun($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 Exit - 1 EndFuncThis one was made by Valik, it's the one I use.. not the one in the Help File. With yours, all someone would have to do is rename the .exe to run another copy. 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...
Valuater Posted March 5, 2006 Share Posted March 5, 2006 I used that for the Welcome to Autoit... not caring if another exe was ran this is XPClean Menu ; check if process already exists $g_szVersion = "My XP Cleaner" If WinExists($g_szVersion) Then MouseMove(500,5) MsgBox(64, "* NOTE * ", "*XPClean Menu* was already running ", 5) SoundPlay ($Sound_lnk,1) Exit; It's already running EndIf AutoItWinSetTitle($g_szVersion) this is for AuoIt-ITS $G_SZVERSION = "Autoit ITS Connection Center* ver " & @AutoItVersion If WinExists($G_SZVERSION) Then Exit; It's already running AutoItWinSetTitle($G_SZVERSION) 3 lines... and no other exe will run 8) 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 5, 2006 Moderators Share Posted March 5, 2006 Well... not to say they would have access to it... but:WinSetTitle("Autoit ITS Connection Center", "", "Something Else") Your way would work, but... IMHO, I think it's better to have the failsafe internally that can't be changed externally Both options are good 'To a point'. 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...
fong1sky Posted June 9, 2006 Share Posted June 9, 2006 I want to know if it is possible to pass the command line parameter to the already running programme, but not duplicate to run. Thank you 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