I have used _Singleton function in my script to restrict only one instance to run.
For testing, I have written below code, and triggered multiple instances.
#include <Misc.au3> MsgBox(0,"",@ScriptName) if _Singleton(@ScriptName, 1) = 0 Then Msgbox(64, @ScriptName, "The program is already running.") Exit Else MsgBox(0,@ScriptName,"No other instances running") EndIf But all are going to else block.
i Tried Using Function _single ton
It Works Like Charm on same computer
But it is unable to catch up when 2 instance of exe are launched in lan pc
I would also like to know if there was a way to make particular number of instance work like allow 4-5 instance of same exe to run
Hi. I'm a teacher and I do a lot of tutorials and other presentations on my computer. I've developed a tool using AutoIt and Adobe AIR to display all the shortcuts I use while I'm presenting. According to the forum rules this would mean that I've developed a keylogger, so I can't show any of the code, but I'm still hoping someone will help me solve an issue I'm having - a memory leak (or at least I think that's it).
I can see the application is taking up more and more memory, but it never goes super crazy. I think it was at 25 MB at one point and that was it. However I see that the longer the application is running less responsive it is. It doesn't capture all the events, or it simply lags.
I'm using AssocArrays and _MouseOnEvent UDFs, _WinAPI_SetTimer, _WinAPI_SetWindowsHookEx, _Singleton and TCP. I've done some research before posting this and I know there are some issues in special cases, but all solutions were "code specific". Since I can't post any of the code I couldn't respond in those threads. Other than that it really doesn't seem to be the problem with any of the UDFs, so my question is:
Is this a memory leak? If so how can I find it and remove it? What to do to avoid it in the future.
I understand that declaring variables over and over (something in the timer) may be the cause of this, so according to what I've read on the forum I've changed the variables to Global and moved them outside the functions. That way they are only declared once, and then only values are being reassigned. That unfortuantly didn't help. Is there anything else I could do or look for?
BTW - I've used Adobe AIR to create a nice UI. If someone want's to create something similar UEZ was kind enough to share his code of creating such GUI with nice antialiased labels.
Hello , Please look at the code below:
; This is not the real script that I use for my project!!! This decoy script helps you understand better ;) #include "Misc.au3" Global $sProgramIdentifier Func Test($sIdentifier) $sIdentifier = $sProgramIdentifier Switch _Singleton($sProgramIdentifier, 1) Case 0 MsgBox(64, "Testing, Testing", "Its working!!") Case Else MsgBox(64, "Testing, Testing", "Its not working!!") EndSwitch EndFunc Test("Lick the lemon") Save this to a file and run it, you will get a MsgBox telling "Its not working!!"
Again, Run the script a second-time without closing the first MsgBox and you will again get a MsgBox telling the same thing!! This was not supposed to happen
How can I get the MsgBox telling that it works ?
Thanks In Advance, TD
I just noticed that Trac ticket #2108 was closed as "No bug".
I understand that the code as it is now might already be broken because it does more than originally intended.
On the other hand the change smartee proposed solved my problem (described ). I implemented and tested smartees code and it now allows to sequentially run compiled scripts an application I can't control starts in a bunch.
I think every code change that enhances the functionality of AutoIt should be welcome. In particular when its jut 2 lines of code and the risk of side effects is minimal.
I vote for implementing smartees change.
Just my 2 cents.