Hobbyist Posted December 29, 2015 Posted December 29, 2015 (edited) 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 scriptIf WinExists($MyScript) Then MsgBox(16, "Notice", "Only One Instance Allowed ") Exit; It's already running AutoItWinSetTitle($MyScript)EndIfThanks Hobbyist Edited December 29, 2015 by Hobbyist
iamtheky Posted December 29, 2015 Posted December 29, 2015 (edited) 1) you probably would want to look for processexists rather than winexists if that's the name of the executable2) You really want singleton, so you should search "singleton" Edited December 29, 2015 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
water Posted December 29, 2015 Posted December 29, 2015 Or check the help file for _Singleton. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
Hobbyist Posted December 29, 2015 Author Posted December 29, 2015 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
iamtheky Posted December 30, 2015 Posted December 30, 2015 Umm, that was not a good recommendation, just slightly more center than winexists, because:$MyScript = " Dash Board"; name of the script If WinExists($MyScript) Thenthe 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 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now