Sign in to follow this  
Followers 0
Bridawg

Can't get _Singleton to work

8 posts in this topic

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")
    Exit
EndIf
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

Thanks

Share this post


Link to post
Share on other sites



is there any change you dont save the script with name "test.au3" ?

try to compiled it as test.exe and run it

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

Bridawg,

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. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

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

Yes, I get that :)  All 3 windows are running at the same time - I don't press "OK" to close them.

post-54192-0-63448100-1390920057_thumb.j

Share this post


Link to post
Share on other sites

Bridawg,

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

saveas test.au3 to desktop

build...

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...

Bill

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.  :)

Bill

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  
Followers 0