Jump to content

Error on "one stance"


Hobbyist
 Share

Recommended Posts

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
Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

Or check the help file for _Singleton.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...