Jump to content

Getting pst-format from its header


dabus
 Share

Recommended Posts

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 by dabus
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...