Jump to content
Hobbyist

Error on "one stance"

Recommended Posts

Hobbyist

I have a newbie question.  I have made my executable and setup. Installed it on my pc. Included in my script is the check for more than one instance of the script running.  I have this error caught in a message box.

IF I have my windows file explorer open and do a single click on the script's program file folder and then go to the desk top icon for my script program and double click to open, I get the one instance error check message.

But I haven't started the script executable prior to double clicking the desk top Icon.

I hope this is clear. So I am asking is there something I don't know about making the one instance work.

This is what I am using.

$MyScript = " Dash Board"; name of the script
If WinExists($MyScript) Then
    MsgBox(16, "Notice", "Only One Instance Allowed ")
    Exit; It's already running
    AutoItWinSetTitle($MyScript)
EndIf

Thanks

 

Hobbyist

Edited by Hobbyist

Share this post


Link to post
Share on other sites
iamtheky

1) you probably would want to look for processexists rather than winexists if that's the name of the executable

2) You really want singleton, so you should search "singleton"

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
water

Or check the help file for _Singleton.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Hobbyist

Thanks to both of you.

I did go the Singleton route.  If I understood the ProcessExist help section, it continues to poll which seems to take resources.

 

Am I correct or misunderstanding?

 

Hobbyist

Share this post


Link to post
Share on other sites
iamtheky

Umm, that was not a good recommendation, just slightly more center than winexists, because:

$MyScript = " Dash Board"; name of the script
If WinExists($MyScript) Then

the whole 'name of the script' thing and then searching for a window of that name while asking about a check that would only allow a single instance of a process seemed crazy :)


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

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

×