What I need help on is a script I have written to close Lotus Notes and delete all temp files. i need my script to be able to kill all Notes processes and delete the temp files so I can relaunch it without having to re-logon. Here is what I have so far.
'*************************
**********
**********
**********
**********
**********
***
Call kill_process_matching("nln
otes.exe,n
hldaemn.ex
e,nupdate.
exe,nwrdae
mn.exe,nno
tesmm.exe,
nlnotes.ex
e,notes.ex
e,nweb.exe
,naldaemn.
exe")
delete_file("C:\Program Files\Lotus\Notes\Data\~no
tes.lck")
delete_file("C:\Program Files\Lotus\Notes\Data\Cac
he.DSK")
delete_file("C:\Program Files\Lotus\Notes\Data\log
.nsf")
'*************************
**********
**********
**********
**********
**********
***
'kill_process_matching(str
_procs)
'
'Description
' This functions checks all running processes for specific processes that are passed to it
' and terminates any that it findes
'inputs
' str_procs a comma delimited list of process names to look for
'
'
'*************************
**********
**********
**********
**********
**********
***
function kill_process_matching(str_
procs)
dim bool_imp_proc_running 'bool value used to identify if an identifed process is running
dim arry_arg_proc_names 'an array of strings used to store the split str_procs
dim obj_service 'used as a winmgmts object
dim obj_current_proc 'used as the current process being checked
dim obj_current_proc_list 'array of objects to bee killed
dim strComputer ' the name of the computer - can be a remote name
dim str_proc_to_kill_name 'string used to store current important process to look for
if trim(str_procs) = "" then
exit function
End IF
arry_arg_proc_names=split(
str_procs,
",")
If not InStr(1, str_procs, ",", 1) >0 Then str_procs=str_procs & ","
strComputer = "."
Set obj_service = GetObject("winmgmts:" _
& "{impersonationLevel=imper
sonate}!\\
" _
& strComputer & "\root\cimv2")
for each str_proc_to_kill_name in arry_arg_proc_names
' loop through the list of passed in process names to kill
Set obj_current_proc_list = obj_service.ExecQuery _
("Select * from Win32_Process Where Name like '" & str_proc_to_kill_name & "'")
on error resume next 'just incase it can't terminate it
For Each obj_current_proc in obj_current_proc_list
' loop through each process that it found matching the current name
obj_current_proc.Terminate
()
Next
on error goto 0
Set obj_current_proc_list = Nothing
Next
End Function
Function delete_file(STR_FQ_FileNam
e)
Dim fso, f1
Set fso = CreateObject("Scripting.Fi
leSystemOb
ject")
If fso.FileExists(STR_FQ_File
Name)Then 'if the file alread exists get the file attributes and prep for writing
On Error Resume Next
Set f1 = fso.GetFile(STR_FQ_FileNam
e)
f1.Attributes=0
f1.Delete
Set f1 = Nothing
On Error GoTo 0
End If
Set fso = Nothing
End Function
'*************************
**********
**********
**********
**********
**********
***
For some reason I am either missing some temp files or some child process that is not letting me re-run Notes in the same windows sesssion. i would like this script to be able to work for Notes versions 5 and 6.5.