I'm sorry but I don't understand what you have written.
Go to layout can change layouts. By setting a margin in "Print properties", I must guess that you mean setting layout margins on the printing tab in Layout Setup... This must be done manually--either from layout setup on the specific layout or Manage | layouts.
Can you post the script?