• Quick note - the problem with Youtube videos not embedding on the forum appears to have been fixed, thanks to ZiprHead. If you do still see problems let me know.

How to Terminate a program

rjh01

Gentleman of leisure
Joined
May 6, 2005
Messages
29,931
Location
Flying around in the sky
I automatically backup some files everyday. The problem is one of them is my Outlook file. I run Outlook all the time and the backup will not run properly when Outlook is running as both want the file to themselves.

So I want to be able to terminate Outlook at a certain time so that the backup will work. How do I do this?

I can manually restart Outlook afterwards. But I need a way for the computer to terminate it without me doing anything at the time.

I use Windows XP and Nero V9 to do the backup.
 
Last edited:
Last edited:
Why not just schedule your backups to run before or after your daily computer usage? That way you can simply close Outlook before that time. After all you are considering manually restarting Outlook as part of a solution.
 
Be aware that using taskkill to stop Outlook could result in a damaged pst file.

My suggestion is to look into AutoIt for closing Outlook. It can simulate mouse clicks and as such you can make a quick, simple AutoIt script that can be compiled to an exe file and set through your task scheduler to run.
 
crontab -e

Add:

* 11 * * * ps -ef | grep Outlook | xargs kill -9
* 12 * * * /home/user/bin/backups.sh 2&1 > /home/user/log/backuplog.txt

Where backups.sh is your rsync to offsite/other disk script to backup data.

Cron ftw.


WHAT? WELL SOMEONE HAD TO MAKE THE *NIX JOKE! IT'S LIKE INTERNET LAW OR SOMETHING!
 
2jfrcj.jpg



closeoutlook.vbs:
Code:
on error resume next
set ol = getobject(, "outlook.application")

if err.number = 0 then
    for each inspector in ol.inspectors
        inspector.close(olsave)
    next

    ol.quit()
end if
 
Last edited:
Thanks for all the ideas. I have downloaded AutoIt.

Tried to run jsiv's macro but got a compile error on ol.quit() it was expecting =. I am using the 2000 version of office.

I might also try to run the backups when I log on and before Outlook starts.
 
crontab -e

Add:

* 11 * * * ps -ef | grep Outlook | xargs kill -9
* 12 * * * /home/user/bin/backups.sh 2&1 > /home/user/log/backuplog.txt


Where backups.sh is your rsync to offsite/other disk script to backup data.

Cron ftw.


WHAT? WELL SOMEONE HAD TO MAKE THE *NIX JOKE! IT'S LIKE INTERNET LAW OR SOMETHING!
What? Doesn't everybody have the MS/Interix services for unix installed?
 
Write a routine that calls Kristianna Loken and your termination trouble will be solved :)
 
Thanks for all the ideas. I have downloaded AutoIt.

Tried to run jsiv's macro but got a compile error on ol.quit() it was expecting =. I am using the 2000 version of office.

I might also try to run the backups when I log on and before Outlook starts.
I'm running 2007, but I'm pretty sure it should work on 2000 as well. Exactly how are you running it? Just double-clicking it/running it with cscript closeoutlook.vbs?
 
What? Doesn't everybody have the MS/Interix services for unix installed?

I do. I wouldn't recommend what Ducky listed for the exact same reason I cautioned against Taskkill (which essentially does the same as kill).
 

Back
Top Bottom