Sign in to follow this  
Followers 0
chenxu

Bug? About _Singleton()

9 posts in this topic

#include "Misc.au3"
if _Singleton("test\test",1) = 0 Then
    Msgbox(0,"Warning","An occurence of test is already running")
    Exit
EndIf
Msgbox(0,"OK","the first occurence of test is running")

this is the script copied from AutoIt help file. the version is v3.2.12.0 acording to the help file. I run the script for the first time and it still clain the warning box: Msgbox(0,"Warning","An occurence of test is already running"), why? is this a bug?

Share this post


Link to post
Share on other sites



#include "Misc.au3"
if _Singleton("test\test",1) = 0 Then
    Msgbox(0,"Warning","An occurence of test is already running")
    Exit
EndIf
Msgbox(0,"OK","the first occurence of test is running")

this is the script copied from AutoIt help file. the version is v3.2.12.0 acording to the help file. I run the script for the first time and it still clain the warning box: Msgbox(0,"Warning","An occurence of test is already running"), why? is this a bug?

Not bugged. Tested on my machine, all Ok here! Are you running it from SciTe or just from the file?

Share this post


Link to post
Share on other sites

Not bugged. Tested on my machine, all Ok here! Are you running it from SciTe or just from the file?

I compiled to exe and run the exe file

Share this post


Link to post
Share on other sites

I think I remember seeing something about that example being bugged. Something about / being invalid in the parameter..?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Intresting, I realised i was running V3.2.10.0 (I think that was it) so I updated, and it didn't work.

And reading the documentation in Misc.au3 I can see:

String to identify the occurrence of the script.  This string may not contain any \ characters unless you are placing the object in a namespace.

EDIT:

http://svn.autoitscript.com/trac/ticket/316

It's set for the next release.

Edited by Bert

Share this post


Link to post
Share on other sites

Intresting, I realised i was running V3.2.10.0 (I think that was it) so I updated, and it didn't work.

And reading the documentation in Misc.au3 I can see:

String to identify the occurrence of the script.  This string may not contain any \ characters unless you are placing the object in a namespace.

EDIT:

http://svn.autoitscript.com/trac/ticket/316

It's set for the next release.

Thank you, I remove the / char from the $sOccurenceName variable and it works now, I think use @ScriptName is a good choice.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Thank you, I remove the / char from the $sOccurenceName variable and it works now, I think use @ScriptName is a good choice.

Dont't thinks so. Just rename the Script and you can run it more than once muttley I suppose to use a GUID which is quite unique :) Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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