Schedule application end
Author
Discussion

dern

Original Poster:

14,055 posts

310 months

Tuesday 11th September 2007
quotequote all
Under windows xp (service pack 2) is there anyway of ending a specific application (outlook) at a particular time of day (midnight)? I occasionally forget to shut outlook down and then it downloads all my mail periodically which means I can't look at it at work using the web mail client.

Thanks,

Mark

Plotloss

67,280 posts

301 months

Tuesday 11th September 2007
quotequote all
You could script it using the vbscript and then execute that vbscript via a scheduled task.

I guess.

The Griffalo

72,863 posts

270 months

Tuesday 11th September 2007
quotequote all
You'd have to call it gracefully or else your .PST's will probably be corrupt and Outlook will certainly grumble next time it starts.

Plotloss

67,280 posts

301 months

Tuesday 11th September 2007
quotequote all
Dim oOL 'As Outlook.Application
Set oOL = GetObject(, "Outlook.Application")
If oOL Is Nothing
'no need to do anything, Outlook is not running
Else
'Outlook running
oOL.Session.Logoff
oOL.Quit
End If
Set oOL = Nothing


Shuts down everything nice and tidy like.

Edited by Plotloss on Tuesday 11th September 19:27

dern

Original Poster:

14,055 posts

310 months

Tuesday 11th September 2007
quotequote all
I wanted to avoid the whole scripting kill -9 type stuff and wondered if there was something in windows to do this that I wasn't aware of.

dern

Original Poster:

14,055 posts

310 months

Tuesday 11th September 2007
quotequote all
Plotloss][NOWIKI said:
That's very cool and looks like it closes it nicely, thanks very much indeed.

Erm, what's vbscript and how do I run it. I know java and c# but... redface

Don't worry, I'll google it wink

Thanks again.

Edited by dern on Tuesday 11th September 19:29

Plotloss

67,280 posts

301 months

Tuesday 11th September 2007
quotequote all
Save the file with the extension .vbs

The script engine is built into Windows.

Just call the killoutlook.vbs file from a scheduled task - job done.

Roy the Boy

471 posts

252 months

Tuesday 11th September 2007
quotequote all
This might be of some use:

http://ask-leo.com/how_do_i_automatically_close_a_...

Actual example used is Outlook but be aware of the pitfalls mentioned.

Oops - hadn't seen other responses before posting this - Plotloss seems to have cracked it!

Edited by Roy the Boy on Tuesday 11th September 19:36

dern

Original Poster:

14,055 posts

310 months

Tuesday 11th September 2007
quotequote all
Plotloss said:
Save the file with the extension .vbs

The script engine is built into Windows.

Just call the killoutlook.vbs file from a scheduled task - job done.
Superb, thank you very much indeed.