topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 12:27 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA : program which waits will specified programs complete  (Read 4362 times)

sprint907

  • Participant
  • Joined in 2012
  • *
  • default avatar
  • Posts: 11
    • View Profile
    • Donate to Member
IDEA : program which waits will specified programs complete
« on: December 27, 2012, 05:47 AM »
This is my requirement...
I am running many instances of xxcopy.exe in multiple command line windows.
I need to shutdown the PC after all the xxcopy.exe process completes.
I need a program which waits till all xxcopy.exe instances are completed

example :- i could write a batch file which has below contents
----------------------------
myprog.exe xxcopy.exe
shutdown -s
----------------------------
The program should wait and then execute the shutdown.


or if i have xxcopy.exe, java.exe, oracle.exe processing running, and I need to send an email after all three have completed...
----------------------------
myprog.exe xxcopy.exe java.exe oracle.exe
sendmail -to [email protected] -subject "complete"
----------------------------

Is such a program possible?

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
Re: IDEA : program which waits will specified programs complete
« Reply #1 on: December 27, 2012, 06:47 AM »
Try this:

WTPF.exe [prog1.exe] [prog2.exe] ........

If there's multiple processes with the same name, you only need to specify it once.

Code: AutoIt [Select]
  1. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_UseUpx=n
  3. #AutoIt3Wrapper_Change2CUI=y
  4. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  5. ;WaitTillProcessFinish (WTPF)
  6.  
  7. $process = False
  8. If $CmdLine[0] = 0 Then Exit
  9.  
  10.         For $i = 1 To $CmdLine[0]
  11.                 $list = ProcessList($CmdLine[$i])
  12.                 If $list[0][0] > 0 Then
  13.                         $process = True
  14.                         ExitLoop
  15.                 Else
  16.                         $process = False
  17.                 EndIf
  18.         Next
  19.         Send("^")
  20.         Sleep(5000)
  21. Until $process = False
« Last Edit: January 27, 2013, 06:38 PM by 4wd, Reason: Sends a Control character to keep system awake. »

sprint907

  • Participant
  • Joined in 2012
  • *
  • default avatar
  • Posts: 11
    • View Profile
    • Donate to Member
Re: IDEA : program which waits will specified programs complete
« Reply #2 on: December 27, 2012, 08:45 AM »
hi 4wd,
This is what I wanted.
Thanks a lot.  Much appreciated.