jdelaney Posted November 11, 2015 Posted November 11, 2015 Won't work.Example: Imagine that (while one instance is running) > 2 new instances get started. Now > 3 instances are active or waiting. When the active instance ended still > 2 instances are waiting. No new instance will start running and all instances will wait forever. the array will always have at least a ubound of 2. If there are any additional, then it's greater than 2. Not sure what you mean by this. Only the singleton would require the loop, right? IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
water Posted November 11, 2015 Posted November 11, 2015 Won't work.Example: Imagine that (while one instance is running) > 2 new instances get started. Now > 3 instances are active or waiting. When the active instance ended still > 2 instances are waiting. No new instance will start running and all instances will wait forever. You start instance 1: UBound(ProcessList(@ScriptName)) returns 2.While instance 1 is running 3 new instances get started. Hence UBound(ProcessList(@ScriptName)) returns 5.When instance 1 has ended UBound(ProcessList(@ScriptName)) returns 4.As this is still > 2 all 3 processes remain in the loop.Or is there an error in my calculation 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
jdelaney Posted November 11, 2015 Posted November 11, 2015 After re-reading the original post, it seems that your driving script should wait for a file, and then initiate another script to do the action on that specific file. If there is more than one file, start two instances, one specific to each file. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
emendelson Posted November 13, 2015 Author Posted November 13, 2015 After re-reading the original post, it seems that your driving script should wait for a file, and then initiate another script to do the action on that specific file. If there is more than one file, start two instances, one specific to each file.That is in fact what I do; that combined with water's mutex method now allow two instances to work at the same time; the problem seems to have caused by the way the two instances each saved a temporary file using the same filename for the temporary file; this caused one instance not to finish. Thanks again to everyone for helping me to sort out this problem.
jdelaney Posted November 13, 2015 Posted November 13, 2015 oh, well, just make your temp file unique...set it's name to the date time stamp down to the thousandths of a second. The odds of any 100 running scripts hitting the same value will be nearly non-existent. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
emendelson Posted November 13, 2015 Author Posted November 13, 2015 oh, well, just make your temp file unique...set it's name to the date time stamp down to the thousandths of a second. The odds of any 100 running scripts hitting the same value will be nearly non-existent.That works! Thank you!
water Posted November 13, 2015 Posted November 13, 2015 To make it more safe add @Computername to the filename (plus the timestamp). 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
water Posted November 13, 2015 Posted November 13, 2015 Or use function _TempFile to generate a unique file name.This example prefixes the name with the @Computername. Makes debugging a bit easier:#include <File.au3> Global $sTempFile = _TempFile(@TempDir, @ComputerName & "_") ConsoleWrite($sTemPFile & @CRLF) 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
Exit Posted November 15, 2015 Posted November 15, 2015 (edited) Just use _SingeScript() function. with imode=1May be found here Edited November 15, 2015 by Exit App: Au3toCmd UDF: _SingleScript()
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