Bagel Posted November 30, 2019 Share Posted November 30, 2019 I have a project I'm working on whereby multiple instances of a script need to be running each of which need to be able to interact with the controls of a non-Autoit GUI. This period of interaction is relatively quick but if more than one script instance attempts to activate controls on the GUI simultaneously the results are undesirable. Is there any way that one script can delay or lock out another from having access to the GUI controls until it's work is completed? Obviously, I have access to the code for the scripts but I do not have access to the code for the GUI. Thanks for any help! Link to comment Share on other sites More sharing options...
Subz Posted November 30, 2019 Share Posted November 30, 2019 Have you tried _Singleton https://www.autoitscript.com/autoit3/docs/libfunctions/_Singleton.htm Link to comment Share on other sites More sharing options...
argumentum Posted November 30, 2019 Share Posted November 30, 2019 ...make yourself a semaphore with an IPC and you should be ok. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
RTFC Posted November 30, 2019 Share Posted November 30, 2019 (edited) 5 hours ago, argumentum said: a semaphore You mean a mutex, not a semaphore. They are not the same thing (see: " a binary semaphore is NOT protecting a resource from access. The act of Giving and Taking a semaphore are fundamentally decoupled."). Funny how people keep confusing the two. And if you use a mutex, you don't need IPC, as the mutex name is globally unique; as long as all instances of the script use the same name, any instance of the script just needs to query whether that mutex is free. Edited November 30, 2019 by RTFC My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
argumentum Posted November 30, 2019 Share Posted November 30, 2019 (edited) 8 hours ago, RTFC said: You mean a mutex, not a semaphore. nope, I typed semaphore and the link is a search of "semaphore vs. mutex". It was not very clear to me his code or trend of thought. I don't get why run another while the original is running, so, I basically meant "read up in what are the possibilities and come up with a simple solution on your own" and I thought at the time that the post was short and sweet PS: ..is so common for the eager to help, ( you, me, etc. ), to heat up a discussion while the OP is not even in sight. ...most times not even a sampler of the code. I see the value of your clarification but at the time I thought I was the "first responder", but @Subz posted sooner ( with basically what is your proposed solution ). I, at times entice ppl, into an expanded dialog to dig for more information, hence my vague and not quite correct ( but not necessarily wrong ) response . ...then again, "show me the code !" ..I aim to help understanding, not necessarily presenting an exact solution as they ( all of 'em ! ), come back with "give me an answer, I'm in a hurry", as in a loop. @Bagel, I'm taking with @RTFC, so...., don't read this ..but do share what you've done to solve your problem. Edited November 30, 2019 by argumentum Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. 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