Overclockers Australia Forums
OCAU News - Wiki - QuickLinks - Pix - Sponsors  

Go Back   Overclockers Australia Forums > Software Topics > Programming & Software Development

Notices


Sign up for a free OCAU account and this ad will go away!
Search our forums with Google:
Reply
 
Thread Tools
Old 11th August 2012, 12:10 AM   #1
Ben Ifin Thread Starter
Member
 
Join Date: Jun 2004
Posts: 809
Default 2 Seperate Tasks in Task Scheduler .... how do I run Task 2 after Task 1 completes ?

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
Ben Ifin is offline   Reply With Quote

Join OCAU to remove this ad!
Old 11th August 2012, 12:17 AM   #2
Fishmaster
Member
 
Fishmaster's Avatar
 
Join Date: Oct 2006
Location: Sydney, 2119
Posts: 1,355
Default

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.
Fishmaster is offline   Reply With Quote
Old 11th August 2012, 12:35 AM   #3
Rezin
Member
 
Rezin's Avatar
 
Join Date: Oct 2002
Posts: 8,023
Default

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
Edit: Actually that won't work as an action. Just stick each on its own line in a batch file.

Code:
start /w calc.exe
start /w notepad.exe

Last edited by Rezin; 11th August 2012 at 12:38 AM.
Rezin is offline   Reply With Quote
Old 11th August 2012, 3:04 PM   #4
Ben Ifin Thread Starter
Member
 
Join Date: Jun 2004
Posts: 809
Default

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.
Ben Ifin is offline   Reply With Quote
Old 11th August 2012, 3:27 PM   #5
Rezin
Member
 
Rezin's Avatar
 
Join Date: Oct 2002
Posts: 8,023
Default

What is the final window for Program.exe (and can you say what that program is)?
Rezin is offline   Reply With Quote
Old 11th August 2012, 3:47 PM   #6
Ben Ifin Thread Starter
Member
 
Join Date: Jun 2004
Posts: 809
Default

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
Ben Ifin is offline   Reply With Quote
Old 11th August 2012, 4:49 PM   #7
Rezin
Member
 
Rezin's Avatar
 
Join Date: Oct 2002
Posts: 8,023
Default

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.
Rezin is offline   Reply With Quote
Old 11th August 2012, 6:30 PM   #8
Zoltag
Member
 
Join Date: Aug 2001
Location: London
Posts: 497
Default

Quote:
Originally Posted by Ben Ifin View Post
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
Seems possible, though tricky:

http://blogs.msdn.com/b/davethompson...r-another.aspx
Zoltag is offline   Reply With Quote
Old 18th August 2012, 10:38 PM   #9
deepspring
Member
 
deepspring's Avatar
 
Join Date: Jul 2002
Location: No Where
Posts: 3,244
Default

Edit: Rezin's recommendation is better than mine. AHK for the win.

Last edited by deepspring; 18th August 2012 at 10:42 PM.
deepspring is offline   Reply With Quote
Reply

Bookmarks

Sign up for a free OCAU account and this ad will go away!

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +10. The time now is 12:32 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. -
OCAU is not responsible for the content of individual messages posted by others.
Other content copyright Overclockers Australia.
OCAU is hosted by Internode!