dabus 0 Posted October 16, 2007 (edited) I want to update my little pst-check-tool that warns users before they blow up their outlook-pst-files. So I need to get the info if the pst-file is a 97-2002 type or above. So I played a bit with pst-headers and I I got this little udf. I think it works. May you test it or give me a hint that I'm done here? Thanks. $Test=IsNewPST('D:\Temp\Test-2003.pst') ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Test = ' & $Test & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console ;=============================================================================== ; ; Function Name: IsNewPST ; Description:: Checks if file has a new pst-format (2003 and up) ; Parameter(s): $File ; Requirement(s): AutoIt 3.2 ++ (older may work too) ; Return Value(s): 1 - New, 0 - Old and @error = 1 - No pst, -1 No file ; Author(s): dabus ; ;=============================================================================== Func IsNewPST($File) ; $Handle = fileOpen($File,4) If $Handle = -1 Then SetError(-1) Return('') Else $Header = fileread($Handle,11) fileclose($Handle) $Header=StringTrimRight($Header, 1) $Header=StringTrimLeft($Header, 2) If StringLeft($Header, 8) <> '2142444E' Then SetError(1) Return('') Else SetError(0) Return(StringRight($Header, 1)) EndIf EndIf EndFunc Edit: Not anyone? Edited October 18, 2007 by dabus Share this post Link to post Share on other sites
picaxe 2 Posted October 17, 2007 Hi dabus Gives correct return values on Office 2k and 2k3 on my systems. Share this post Link to post Share on other sites
dabus 0 Posted October 17, 2007 Cool, thanks for testing. Funny that it works as expected, since I just compared the first few characters and it seems like I got the right thing. Share this post Link to post Share on other sites