Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

_Singleton Generates Multiple Objects!

$
0
0

Hello :bye:, Please look at the code below:

  1. ; This is not the real script that I use for my project!!! This decoy script helps you understand better ;)
  2.  
  3. #include "Misc.au3"
  4.  
  5. Global $sProgramIdentifier
  6.  
  7. Func Test($sIdentifier)
  8.     $sIdentifier = $sProgramIdentifier
  9.     Switch _Singleton($sProgramIdentifier, 1)
  10.         Case 0
  11.             MsgBox(64, "Testing, Testing", "Its working!!")
  12.         Case Else
  13.             MsgBox(64, "Testing, Testing", "Its not working!!")
  14.     EndSwitch
  15.  
  16. 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 :unsure:?

 

Thanks In Advance, TD :)


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>