Sub Main
  'General test and demo program of a range of scripting.
  'Change this file name to "onReceive.txt" to activate it.
  '
  'A) Checking PixieRobot properties as setup from PixieRobot.ini
  '
  s = "onReceive.txt Scripting Test, " & Now & vbcrlf & vbcrlf
  s = s & "Check settings:" & vbcrlf
  s = s & "ReturnAddress = " & ReturnAddress & vbcrlf
  s = s & "PathHome      = " & PathHome & vbcrlf
  s = s & "PathAttachIn  = " & PathAttachIn & vbcrlf
  s = s & "PathAttachOut = " & PathAttachOut & vbcrlf
  s = s & "PathMsgIn     = " & PathMsgIn & vbcrlf
  s = s & "PathMsgOut    = " & PathMsgOut & vbcrlf & vbcrlf
  '
  'B) List attachments with this message
  '
  s = s & "Attachments:" & vbcrlf
  s = s & "AttachNumber  = " & AttachNumber & vbCrLf
  For Index = 1 to AttachNumber
    s = s & "AttachFile(" & Index & ") = " _
    & AttachFile(Index) & vbCrLf
  Next
  '
  '
  'C)  Copy all attachments to another folder.  Change "C:\TEMP"
  'to something more appropriate for you if need be
  '
  Call AttachCopyAll("C:\Temp")
  '
  'D)  Retrieve parent message header (1) as 1 text, (2) by individual line
  '
  s = s & vbcrlf & vbcrlf
  s = s & "Header function test" & vbcrlf
  s = s & "1) total header:" & vbcrlf
  s = s & Header & vbcrlf & vbcrlf 
  s = s & "2) by lookup:" & vbcrlf
  s = s & "Header(""Date"") = " & Header("Date") & vbcrlf
  s = s & "Header(""To"")   = " & Header("To") & vbcrlf
  s = s & "Header(""From"") = " & Header("From") & vbcrlf
  s = s & "Header(""Subject"") = " & Header("Subject") & vbcrlf  
  s = s & "Header(""CC"")   = " & Header("CC") & vbcrlf
  s = s & "Header(""BCC"")  = " & Header("BCC") & vbcrlf
  s = s & "Header(""X-Attachments"") = " & Header("X-Attachments") & vbcrlf
  '
  'E) Write to file this report string s we have built
  'Note that this script will re-run with every message, so 
  'we use the Timer function to generate new report file names each time.
  '
  sGeneratedName = "test" & Right("0000000" & Fix(Timer * 100), 7) & ".txt"
  Call OutputToFile(s, sGeneratedName)
End Sub
