Macro to get & set the document custom properties

Using LO Version: 5.0.2.2 on iMac with OSX 10.10.5

I have a need to get and set these document custom properties:

I used the record a macro facility whist changing displayCopyright from Yes to No.
This is the macro code I got:

 REM  *****  BASIC  *****


sub Main
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(9) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Properties.UseUserData"
args1(0).Value = true
args1(1).Name = "Properties.DeleteUserData"
args1(1).Value = false
args1(2).Name = "Properties.Title"
args1(2).Value = "SecretaryBird template"
args1(3).Name = "Properties.Subject"
args1(3).Value = ""
args1(4).Name = "Properties.KeyWords"
args1(4).Value = ""
args1(5).Name = "Properties.Description"
args1(5).Value = ""
args1(6).Name = "Properties.AutoReload"
args1(6).Value = false
args1(7).Name = "Properties.AutoReloadTime"
args1(7).Value = 0
args1(8).Name = "Properties.AutoReloadURL"
args1(8).Value = ""
args1(9).Name = "Properties.AutoReloadFrame"
args1(9).Value = ""

dispatcher.executeDispatch(document, ".uno:SetDocumentProperties", "", 0, args1())


end sub  

Which is NOT a lot of help!

Can anyone give me any pointers/suggestions?

Thanks to Andrew Pitonyak’s document

AndrewMacro.odt

see his website here

I’ve found the solution:

sub getsetDocCustomProperties
  Dim oProps	as object
  Dim oDocProps	as object
  dim s as string

oDocProps = ThisComponent.getDocumentProperties()
oProps = oDocProps.UserDefinedProperties
 s = s & "Classification = " & oProps.[Classification] & CHR$(10) & _
      "Poetic Form = " & oProps.[Poetic Form] & CHR$(10) & _
      "Subclassification = " & oProps.[Subclassification] & CHR$(10) & _
      "Version number = " & oProps.[Version number]& CHR$(10) & _
      "Version suffix = " & oProps.[Version suffix]& CHR$(10) & _
      "displayCopyright = " & oProps.[displayCopyright]& CHR$(10) & _
      "displayLogo = " & oProps.[displayLogo]& CHR$(10) & _
     "displayModificationTimeDate = " & oProps.[displayModificationTimeDate]& CHR$(10) & _
     "displayPageNumber = " & oProps.[displayPageNumber]& CHR$(10) & _
     "displayVersion = " & oProps.[displayVersion]
  MsgBox s
  ' try changing
   oProps.[Classification]="SCIENCE"
   
end sub