dabus Posted October 16, 2007 Share 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 Link to comment Share on other sites More sharing options...
dabus Posted October 17, 2007 Author Share Posted October 17, 2007 Bump. Link to comment Share on other sites More sharing options...
picaxe Posted October 17, 2007 Share Posted October 17, 2007 Hi dabus Gives correct return values on Office 2k and 2k3 on my systems. Link to comment Share on other sites More sharing options...
dabus Posted October 17, 2007 Author Share 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now