How could I check if the LegalCopyright is present for a file with out getting a error for those that doesn't have the LegalCopyright properties set.
Think I tried them all (IsSupported, IsNull, IsNothing, IsEmpty, Len > 0 ...)
---Code---
Copyright = aqFileSystem.GetFileInfo(file).VersionInfo.LegalCopyright
>>>If Copyright.Exists Then
Log.Message ("Copyright for the file "+ file + " is ...")
Else
Log.Warning ("Copyright for the file "+ file + " is missing!")
end if
Sub Main
Dim file, fileObj, Copyright
file = "<full name>"
Set fileObj = aqFileSystem.GetFileInfo(file)
Copyright = getCopyright(fileObj)
If Len(Copyright) > 0 Then
Log.Message ("Copyright for the file "+ file + " is " + Copyright)
Else
Log.Warning ("Copyright for the file "+ file + " is missing!")
End If
End Sub
Function getCopyright(fileObj)
Dim VerInfo
If fileObj.VersionInfo Is Nothing Then
Log.Warning "No version info in file."
getCopyright = ""
Exit Function
End If
Set VerInfo = fileObj.VersionInfo
If Len(VerInfo.LegalCopyright(0)) = 0 Then
Log.Warning "No legal copyright in version info field."
getCopyright = ""
Exit Function
End If
getCopyright = VerInfo.LegalCopyright(0)
End Function
Subject | Author | Latest Post |
---|---|---|