![]() |
![]() OCAU News - Wiki - QuickLinks - Pix - Sponsors |
|
|||||||
| Notices |
|
Sign up for a free OCAU account and this ad will go away! Search our forums with Google: |
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Member
Join Date: Jun 2004
Posts: 809
|
Hi all !
I need some help [ again please ]. I want to run 2 seperate and different Tasks in Task Scheduler in Windows 7 x64 so that Task 2 runs immedialty and automatically as soon as Task 1 completes. In short, I have:- - Task 1 in Task Scheduler which runs a specific program and then the program closes when it finishes running and - Task 2 in Task Scheduler which Shuts down and Re-Starts the PC Both Task 1 and Task 2 in Task Scheduler work perfectly each standalone by themsleves. What would I please like help with ? I want to run Task 2 automatically and immedialty as soon as Task 1 finishes. Can someone please advise how I achive this in Task Scheduler ? Many sincere thanks again, Ben |
|
|
|
| Join OCAU to remove this ad! |
|
|
#2 |
|
Member
Join Date: Oct 2006
Location: Sydney, 2119
Posts: 1,356
|
Does the program run in Task 1 write to the event log when it opens or closes? If it does you can set the trigger for Task 2 on the close event in the event log.
In Task Manager under create task (not create basic task) check out the triggers that can be done on an event that's logged to Windows in some sort of form. If that doesn't work just have the original program run a batch script. The script starts the first program and waits for it to exit then continues onto its next command which would be the shutdown. |
|
|
|
|
|
#3 |
|
Member
Join Date: Oct 2002
Posts: 8,055
|
Like what Fishmaster said. http://support.microsoft.com/kb/198044
Or even use the (example) following with the Task Scheduler's action. Code:
start /w calc.exe && start /w notepad.exe Code:
start /w calc.exe start /w notepad.exe Last edited by Rezin; 11th August 2012 at 12:38 AM. |
|
|
|
|
|
#4 |
|
Member
Join Date: Jun 2004
Posts: 809
|
Hi Fishmaster & Rezin $ Everyone !
Firslty, thanks heaps. I am *nearly* there. I am now doing it with a .bat file and the text of it is below. L1 @ECHO OFF L2 Program.exe L3 shutdown.exe -r -t 02 L4 PAUSE It's working but with ONE GLITCH. When I run the above .bat file [ without the red Line counters of course ] , the first Task - Program.exe - leaves its final Window OPEN and as such, the .bat stops and it wont proceed to the shutdown and reboot. If I *manually* close the remaniing Program.exe OPEN WINDOW, the .bat then automaticaly continues and does do the 2 second shutdown and re-boot. So .... unless I am mistaken, I am missing either -> additional syntax added to the end of the existing L2 or -> a new additioal Line inserted between the existing L2 and L3 Any advice / help is again, genuinely appreciated. Ben Last edited by Ben Ifin; 11th August 2012 at 3:22 PM. |
|
|
|
|
|
#5 |
|
Member
Join Date: Oct 2002
Posts: 8,055
|
What is the final window for Program.exe (and can you say what that program is)?
|
|
|
|
|
|
#6 |
|
Member
Join Date: Jun 2004
Posts: 809
|
Hi Rezin !
The final remaining OPEN window is simply an " information screen " listing the progam details, authors, version etc..... you can either click the " OK " button *or* the top right-hand corner WINDOW CLOSE X. Either way, if you manully hit either of these the remaining OPEN Window will close and the .bat continues automatically as it should. [ not meaning to be secretive .... its actually an audio program which cleans the recording file cache as each recording session finishes ] So... I guess ( ? ) ...... I presume ( ? ) ...... all I need the .bat to do is to automatically enact the OK button or the WINDOW CLOSE X. Thanks again, Ben |
|
|
|
|
|
#7 |
|
Member
Join Date: Oct 2002
Posts: 8,055
|
Can this program be run 'quietly' (so it doesn't show the info screen at the end)? Maybe it has a command line switch that would let it do that.
Otherwise, it might be better to use something like an AutoHotKey script (instead of the batch file), which could run that program, close the dialog, and then do the shutdown. |
|
|
|
|
|
#8 | |
|
Member
Join Date: Aug 2001
Location: London
Posts: 502
|
Quote:
http://blogs.msdn.com/b/davethompson...r-another.aspx |
|
|
|
|
|
|
#9 |
|
Member
Join Date: Jul 2002
Location: No Where
Posts: 3,244
|
Edit: Rezin's recommendation is better than mine. AHK for the win.
Last edited by deepspring; 18th August 2012 at 10:42 PM. |
|
|
|
![]() |
| Bookmarks |
|
Sign up for a free OCAU account and this ad will go away! |
| Thread Tools | |
|
|