Jump to content

Recommended Posts

Posted

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.
Posted

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

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

 

Posted

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.
Posted

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. 

 

Posted

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.
Posted

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!

Posted

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

 

Posted

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

 

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
×
×
  • Create New...