Jump to content
ur

How to keep the script waiting if another instance is running?

Recommended Posts

ur

Is there anyway to check whether the script is launched already and wait till the other instance is closed and continue after that.

 

Share this post


Link to post
Share on other sites
water

Either use _Singleton or Processlist in a loop to check for more than one instance. 

Edited by water

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
ur

Singleton process we can check another process or exe, but I want to check if any instances of my own script is running and wait for its completion.

 

Present I am tracking that with a text file.But I think that is not a right way.

Share this post


Link to post
Share on other sites
water

Please reread the help file for _Singleton. It is not limited to other processes or programs. 


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
Earthshine

You should be able to look at the cmdline of the process and look for your script name


My resources are limited. You must ask the right questions

 

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

  • Similar Content

    • ur
      By ur
      I have used _Singleton function in my script to restrict only one instance to run.
      For testing, I have written below code, and triggered multiple instances.
      #include <Misc.au3> MsgBox(0,"",@ScriptName) if _Singleton(@ScriptName, 1) = 0 Then Msgbox(64, @ScriptName, "The program is already running.") Exit Else MsgBox(0,@ScriptName,"No other instances running") EndIf But all are going to else block.
       
      Please suggest.
    • Jefrey
      By Jefrey
      Hi all!
      I've made this small UDF to emulate multithreading for AutoIt3.
      As we know, AU3 is singlethread and multithreading is only possible through direct ASM. This UDF provides a multithreading emulation through running multiple instances of your script. It also provides an easy way for sending and receiving messages between threads (temporary files are used).
      Example:
      Example 2:
      Docs:
      Download:
      Github ZIP
      Fork me on Github
    • david1337
      By david1337
      Hi guys
      I have a script that runs for about 20 seconds.
      If Outlook.exe is not already open, and I open it while the script is running, I want Outlook to wait until the script is done, and then open.
      Is it possible to set an application in some sort of idle state until the script is done? I want to avoid it from just closing Outlook, and open it again.
       
      Thanks
      David
    • Wicked_Caty
      By Wicked_Caty
      I've written a bot that is loading down  pictures from a website. Basically, it opens the website, saves the picture via context menu, and hits a button for loading the next pic. Unfortunately, the pics and my internet connection aren't always the same and it takes longer to load at times. Right now I've got a sleep(3000) in my code, but it isn't very efficient. I waste time if it loads faster than 3000ms, and the program fails if it takes more than 3000ms. So I wanted to make a function that waits until the picture has loaded, and then saves it. 
      I don't know if that causes any problems with possible functions, but it isn't the tab that's loading. The loading circle doesn't appear. It's something on the website.
      I've adapted to program to chrome, so I'd have to rewrite it partially for the IE functions, so it'd be nice if there was a solution for chrome. --- Thanks!
    • bobbyab9987
      By bobbyab9987
      Hi friends,
      Suppose MyProgram is a tabbed program, meaning that it allows for opening multiple files in the same instance.
      I want to open File1, File2 and File3 in one instance of MyProgram from an AutoIT script. How can I do this?
      I have read the AutoIT Help File about "ShellExecute" and "Run", but I have found nothing helpful.
      Thanks for reading my question. Any answer would be very appreciated.
       
       
×