Champak Posted May 14, 2006 Share Posted May 14, 2006 I'm trying to make sure that I only have one script/exe open of what I am trying to put together. I did a search and came up with process exist and wait. However, when using those, it prevents the first instance of the script/exe from opening in the first place. Is there a way to make sure only one is open at a time? The reason I'm doing this, is when I have the same script open more than once...without it running...I get an error. Link to comment Share on other sites More sharing options...
Valuater Posted May 14, 2006 Share Posted May 14, 2006 there are many ways to do this this is what i use 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...
Simucal Posted May 14, 2006 Share Posted May 14, 2006 Also, you could look up _Singleton in the help file. AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
Champak Posted May 14, 2006 Author Share Posted May 14, 2006 Thanks Valuator, that worked. Simucal, I can't find that in the help manual. Now there is another problem. I've set something up that will write the position of the window to the ini file, so it will open up in the same place that it closes. However, with this now, I get an error pop up when it prevents the second window from opening up relating to the ini write on autoexit function. It seems that this is happening because it is skipping over all of the variables and going straight to autoexit, so the function is unable to read the variables and arrays inbetween. Am I going to have to choose one or the other? Or is there a way around this? Link to comment Share on other sites More sharing options...
Simucal Posted May 14, 2006 Share Posted May 14, 2006 Simucal, I can't find that in the help manual.Try checking the BETA helpfile. Function Reference _Singleton -------------------------------------------------------------------------------- Check if no other occurrence is running. #include <Misc.au3> _Singleton($occurrenceName [,$flag=0 ))) Parameters $occurrenceName string to identify the occurrence of the script $flag when 1 the function return on error Return Value On Flag = 1 otherwise the script is exited Success: Returns 1 Failure: Returns 0 Remarks If an occurrence is already found the script is exited. The second call to the function in the same running script will fail. Example #include "Misc.au3" if _Singleton("test\test",1) = 0 Then Msgbox(0,"Warning","An occurence of test is already running") Exit EndIf Msgbox(0,"OK","the first occurence of test is running") AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
Valuater Posted May 15, 2006 Share Posted May 15, 2006 Thanks Valuator, that worked. Simucal, I can't find that in the help manual.Now there is another problem. I've set something up that will write the position of the window to the ini file, so it will open up in the same place that it closes. However, with this now, I get an error pop up when it prevents the second window from opening up relating to the ini write on autoexit function. It seems that this is happening because it is skipping over all of the variables and going straight to autoexit, so the function is unable to read the variables and arrays inbetween. Am I going to have to choose one or the other? Or is there a way around this?Welcome...the only way anyone can help you is to see your current script... we dont like to guess here8) 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