FengHuangWuShen Posted May 10, 2017 Share Posted May 10, 2017 (edited) #Include <Process.au3> Func Instance_Check() Local $PROCESS_COUNT = 0 Local $PROCESS_LIST = ProcessList('SomePrcoess.exe') For $i = 1 To $PROCESS_LIST[0][0] $PROCESS_COUNT = $PROCESS_COUNT + 1 Next If $PROCESS_COUNT > 1 Then Exit ;MsgBox(0, 'DEBUG - Failed!', 'Multi-insatance.') Else MsgBox(0, 'DEBUG - Success!', 'One instance.') EndIf EndFunc Edited May 13, 2017 by FengHuangWuShen Link to comment Share on other sites More sharing options...
AndyG Posted May 10, 2017 Share Posted May 10, 2017 (edited) #include <Misc.au3> _singleton() Edited May 10, 2017 by AndyG Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 10, 2017 Moderators Share Posted May 10, 2017 @FengHuangWuShen if this was meant as an Example, actually explaining why it is useful would be awesome, rather than just posting a code block - especially an explanation on how this would be better than using _Singleton() as is suggested above. If you're trying to use the code block and having problems, again an actual description would be a lot better than simply posting a block of code and asking everyone to guess. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
FengHuangWuShen Posted May 10, 2017 Author Share Posted May 10, 2017 The singleton function just seemed really large, and the code above seems to achieve the same thing. I was just thinking it was a different way to go about it I guess, and if anyone who is new to autoit like myself, they could see an easy example of how I came to make it work. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 11, 2017 Moderators Share Posted May 11, 2017 ^^^^^^Information that would have been great in your first post... "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
FengHuangWuShen Posted May 11, 2017 Author Share Posted May 11, 2017 True My bad TheSaint 1 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