BREAK ON
CLS
DIM $servername, $nk2, $profilepath, $searchstring, $sharepath, $programpath, $cmdstring, $runline, $cmdline
;
;Edit Variables
;
$servername = ho00060lp57
;For example $ServerName = "Server1" or "Server1.yourdomain.com"
$AppD = ReadValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', 'AppData')
???$AppD
$profilepath = $AppD+"\Microsoft\Outlook\"
;For example $ProfilePath = "%USERPROFILE%\Application Data\Microsoft\Outlook\Outlook.NK2", or "Null"
; NOTE: Don't forget to double up the @@ for an e-mail address
$searchstring = "test@@test.com"
;-------------------------------------------------------------------------------------------------------------------------------------------
;-------------------------------------------------------------------------------------------------------------------------------------------
$sharepath = "c:\!KIX\"
;$sharepath = "\\" + $servername + "\nk2view\"
$programpath = $sharepath + "nk2view.exe"
;This section fills in the default NK2 path
IF NOT EXIST($profilepath)
$profilepath = "%USERPROFILE%\Application Data\Microsoft\Outlook\Outlook.NK2"
ENDIF
IF EXIST($AppD+'\Microsoft\Outlook\*.bak'+@YEAR+@MONTHNO+@MDAYNO+@TIME)
RETURN ; RETURN maybe better than EXIT as RETURN takes you back to where left off
ENDIF
IF EXIST($AppD+'\Microsoft\Outlook\*.nk2')
;Searches for files ending with .NK2 and creates backup.
; -- You want to do a copy to backup before messing with the file...
; -- You may also do a check to insure Outlook is closed before proceeding
debug on
SHELL '%COMSPEC% /C COPY "'+$profilepath+'*.NK2" "'+$profilepath+'*.bak"'
;COPY "MyDir\file*.txt" "MyDir\file*.bak"
???@SERROR+@ERROR
;MOVE $AppD+'\Microsoft\Outlook\*.nk2' $AppD+'\Microsoft\Outlook\*.bak'+@YEAR+@MONTHNO+@MDAYNO+@TIME
; NOTE: You may run into a problem with multiple nk2 files... '*.NK2"'
$cmdstring = $programpath + ' /nk2file "' + $profilepath+'*.NK2"'
?$cmdstring
$runline = $cmdstring + ' /delete ' + $searchstring
?$RUNLINE
SHELL $runline
???@SERROR+@ERROR
ENDIF
get $