I hate making UDFs that are dependent on external EXEs, but this works too...

Code:
 
break on
 
if isfileopen("outlook.pst")
"File is Open"
else
"File is not Open"
endif
 
 

function isfileopen($file)
dim $output, $line
$output=wshpipe('openfiles /query',1)
for each $line in $output
if right($line,len($file))=$file
$isfileopen=1
endif
next
endfunction
 

Function WshPipe($ShellCMD, OPTIONAL $NoEcho)
Dim $oExec, $Output
$oExec = CreateObject("WScript.Shell").Exec($ShellCMD)
If Not VarType($oExec)=9 $WshPipe="WScript.Shell Exec Unsupported" Exit 10 EndIf
$Output = $oExec.StdOut.ReadAll + $oExec.StdErr.ReadAll
If Not $NoEcho $Output Endif
$WshPipe=Split(Join(Split($Output,CHR(13)),''),CHR(10))
Exit($oExec.ExitCode)
EndFunction