Jump to content
Sign in to follow this  

Can't get _Singleton to work

Recommended Posts

So I'm running the sample from the singleton help page and it's not working properly:

#include <Misc.au3>
#include <MsgBoxConstants.au3>

If _Singleton("test", 1) = 0 Then
    MsgBox($MB_SYSTEMMODAL, "Warning", "An occurence of test is already running")
MsgBox($MB_SYSTEMMODAL, "OK", "the first occurence of test is running")

I can run as many instances of this as I like but the "Warning" never triggers.

The return value of _Singleton is 0x0000020C but testing for that doesn't get me any further. Any Advice?

I'm running the portable version of   title="AutoIt v3.3.10.2">AutoIt v3.3.10.2 on Windows 7 Enterprise SP1 32 Bit


Share this post

Link to post
Share on other sites

I saved the script above as test.au3 and compiled it. The result is the same 3 boxes saying that the first instance is running. Really strange.

Share this post

Link to post
Share on other sites


You do realise that you need to keep the first instance running? :huh:

Run the exe for the first time and leave the "first occurence" MsgBox on screen. Now run the exe again and the "already running" MsgBox appears. ;)


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites


I just tested Portable Version, same setup as you...

saveas test.au3 to desktop


start test.exe  x  3

and I get 1 x the first occurence of test is running

and 2 x An occurence of test is already running

also went ahead and tested on Win 8 64 bit and that works fine too...


Share this post

Link to post
Share on other sites

Thanks Bill - that's good to know. Do you know if my Singleton return value (0x0000020C) is unusual?  I'm on a corporate network. I looked at the UDF and it's a DLL call so I'm wondering if I'm somehow locked down.

Thanks, Brian

Share this post

Link to post
Share on other sites

Hi Brian,

Sorry, no.idea I just ran it a couple of times to see the return it was always similar number last 3 number and a letter.

only thing I can still think of is the pc I ran the Portable on already has AutoIT installed so maybe you have a permission issue on your usb or script...or as you say the udf are not being granted access through the bus.

good luck anyway.  :)


Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...