mple also includes error checking.<BR>
  <FONT face="Courier New" size=2><STRONG>Sub Main<BR>&nbsp; s = 
  LCase(Header("Subject"))<BR>&nbsp; b = True <BR>  &nbsp; If Instr(s, "orders") 
  Then&nbsp;<BR>&nbsp;&nbsp;&nbsp; b =           AttachMoveAll("J:\AttachIn\Orders\") 
  </STRONG></FONT><FONT face="Courier New" size=2><BR><STRONG>  
  &nbsp; ElseIf Instr(s, "quotes") Then&nbsp;<BR>&nbsp;&nbsp;&nbsp; b = 
  AttachMoveAll("J:\AttachIn\Quotes\") <BR>  &nbsp; ElseIf Instr(s, 
  "picked") Then&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;b = 
  AttachMoveAll("J:\AttachIn\Picked\") <BR>&nbsp; End If <BR>&nbsp; If b = False 
  Then '-- do EMERGENCY STOP <BR>&nbsp;&nbsp;&nbsp; Call LogMessage("ERROR:&nbsp;in&nbsp;move 
  of attachment, subject = '" &amp; s _ 
  <BR>&nbsp;&nbsp;&nbsp; &amp; "' at " &amp; Now &amp; ".&nbsp; PixieRobot 
  EMERGENCY STOP.") <BR>&nbsp;&nbsp;&nbsp; Call Shutdown <BR>&nbsp; End 
  If<BR>End Sub<BR></STRONG><FONT face="Times New Roman" size=3></FONT></FONT>
  <LI><FONT face="Courier New" size=2><FONT face="Times New Roman" size=3>If you would like to 
  call the script something other than "onReceive.txt",<BR>eg "myScript.vbs", 
  then use the "ScriptOnReceive=" line in 
  "PixieRobot.ini"<BR>eg<BR></FONT><STRONG>ScriptOnReceive=myScript.vbs<BR></STRONG></FONT>
	<LI>
  <P style="MARGIN-BOTTOM: 0in">The PixieRobot methods and 
  properties are supplied as an implicit object, ie functions such as  <FONT 
  face="Courier New" size=2><STRONG>AttachMove</STRONG></FONT>   
	          
	&nbsp; become part of the VBSCRIPT language for this
	environment.  If you wish to write in object syntax, that implicit
	object is called "IM", so both of the following mean the
	same:<BR><FONT size=2><B><FONT FACE="Courier New, monospace">Call
	IM.AttachMoveAll("\\tserver\xrepos\kt\")<BR>Call
	AttachMoveAll("\\tserver\xrepos\kt\")<BR></FONT></B></P></FONT>
	<LI>
  <P style="MARGIN-BOTTOM: 0in">Some VARs may wish to 
  script using the System.FileSystemObject. An implicit one of these named FS is 
  already provided, and you can use all of its methods and properties 
  directly.&nbsp;eg<BR><FONT face="Courier New" size=2><STRONG>Set drv = 
  GetDrive(GetDriveName(drvPath))<BR></STRONG></FONT>      
	          
	        NOTE that you  still
	need to&nbsp;set and use sub-objects&nbsp;eg drv above<BR><BR></P>
	<P STYLE="MARGIN-BOTTOM: 0in"></P></LI></UL>
<P><STRONG><FONT SIZE=4>VBSCRIPT - notes </FONT></STRONG>
</P>
<UL>
	<LI><P STYLE="MARGIN-BOTTOM: 0in">The For ... Next loop requires
	that the closing keyword "Next" be on its own with no
	variable with it.&nbsp; That can be tricky to get used to,
	especially with the less than helpful error message it gives:&nbsp;
	<FONT SIZE=2><FONT FACE="Courier New"><STRONG>"1025, Expected
	end of statement"&nbsp; eg:<BR><B>'<BR></B></STRONG><B><FONT color=green>
	'distribute multiple attachments<BR></FONT>For i = 1 To AttachNumber <BR>&nbsp;
	Call AttachMove(i, sDestination(i))<BR>Next<BR><FONT color=green>'note this 
  must NOT be "Next i"</FONT>    
	  </B><BR></FONT></FONT><BR>
	</P>
	<LI><P>Method calls eg AttachCopyAll, as in all Visual Basic, have 2
	alternative syntaxes: Listing without parentheses, and CALL with
	parentheses.&nbsp; eg:<BR><BR><B><FONT FACE="Courier New, monospace" size=2 
 >AttachCopyAll
	"C:\Program Files\PixiePCL\Brother1\"</FONT></B><STRONG><FONT FACE="Courier New"><BR></FONT></STRONG>or<BR><STRONG><FONT FACE="Courier New" size=2>Call 
  AttachCopyAll ("C:\Program Files\PixiePCL\Brother1\")<BR></FONT></STRONG><BR><FONT SIZE=3><FONT FACE="Times New Roman">The first 
  "list" syntax seems to&nbsp;have been the "Microsoft Way" judging by their published 
  example code, but many of us who work with PICK are more comfortable with the         
  <STRONG><FONT FACE="Courier New"  
  size=2>Call(..)</FONT></STRONG>&nbsp; </FONT>syntax so&nbsp;we 
  use it in this documentation.<BR>ALSO, fashions are now changing at 
  Microsoft,&nbsp;eg the new dotNet BASICs will only support use of 
  parentheses<BR>so that gives a get-used-to-dotNet&nbsp;reason for 
  using<STRONG><FONT face="Courier New" size=2> Call(..)</FONT></STRONG><BR>
  <BR>
  Another syntax:<BR>
  <FONT face="Courier New" size=2><STRONG>b =   AttachCopyAll("C:\Program 
  Files\PixiePCL\Brother1\")</STRONG></FONT><BR>
  What is happening here is that<FONT face="Courier New" 
  size=2><STRONG> AttachCopyAll </STRONG></FONT>
         and some other<BR>
  related methods go further and double as&nbsp;<FONT 
  face="Courier New" size=2><STRONG> functions </STRONG></FONT>
         which can return<BR>
  results "True" or "False" to indicate success of operation.<BR>
  You use this to script error handling.<BR>eg<BR>
  <FONT face="Courier New" size=2><STRONG>
  b =
    AttachMoveAll("C:\Program Files\PixiePCL\Brother1\")<BR>If b = False Then Call 
  Shutdown</STRONG></FONT>      
  &nbsp;<BR></STRONG></FONT></P></LI>
</UL>
<P><FONT SIZE=4>      
     </FONT>&nbsp;<FONT SIZE=4 face=Arial><STRONG>IM 
(Internet Mail Object): details of&nbsp;the scripting properties and methods 
<BR></STRONG>   Grouped by purpose, all
keywords and file/path strings are case-insensitive.</FONT></P>
<P><STRONG><FONT face=Arial>Archive</FONT><BR></STRONG>Boolean&nbsp;property 
eg&nbsp;<BR><STRONG><FONT face="Courier New" size=2>Archive =       True&nbsp; 'files sent are saved 
in archive folders<BR>Archive = False '(default) all files sent are 
deleted</FONT></STRONG></P>
<P><FONT face=Arial><FONT 
face=Arial><BR><STRONG>AttachNumber<BR></STRONG></FONT><FONT size=2>How many attached files 
there are in the message just arrived.</FONT></FONT><FONT face=Arial><STRONG><FONT 
face=Arial><BR>AttachFile( Index )<BR></FONT></STRONG><FONT 
size=2>String 
property to get the name of each attached file by an index from 1 to 
AttachNumber<BR>            
    eg</FONT> <BR></FONT><STRONG><FONT face="Courier New" size=2><FONT color=green>'This script fragment 
moves attachments to folders <BR>'according to the file extension<BR>'of the 
attachment file name.&nbsp; <BR>'eg "apricot.doc" gets moved to folder 
"C:\D3Shared\Transfer\doc"<BR></FONT>sFolder =                       "C:\D3Shared\Transfer\"<BR>For Index = 1 To AttachNumber<BR>&nbsp; Call AttachMove(Index, sFolder 
_<BR>&nbsp; &amp; Mid(AttachFile(Index), 
Instrrev(AttachFile(Index), ".")) _<BR > &nbsp; &amp;
"\"<BR>Next</FONT></STRONG></P>
<P style="MARGIN-BOTTOM: 0in"><FONT face=Arial><BR><STRONG>Call AttachCopy( 
<EM>Index,&nbsp;Destination </EM></STRONG> </FONT><STRONG>) 
<BR></STRONG><FONT face=Arial><STRONG>Call AttachMove( 
<EM>Index,&nbsp;Destination </EM>) <BR></STRONG><FONT size=2>Copy 
or&nbsp;move attachment individually. <BR>These also double as functions 
returning True or False eg b =  
AttachMove(1, "p:\orders\")<BR></FONT></FONT></P>
<TABLE WIDTH="100%" BORDER=1 CELLPADDING=5 CELLSPACING=3 FRAME=below RULES=rows>
  <COLGROUP>
	<COL WIDTH=56>
	<COL WIDTH=200>
	<TR VALIGN=top>
		<TD WIDTH="22%">
			<P><B>Part</B></P>
		</TD>
		<TD WIDTH="78%">
			<P><B>Description</B></P>
		</TD>
	</TR>
	<TR VALIGN=top>
		<TD WIDTH="22%">
			<P><I>Index</I></P>
		</TD>
		<TD WIDTH="78%">
			Number between 1 and 
  AttachNumber
		</TD>
	</TR>
	<TR VALIGN=top>
		<TD WIDTH="22%">
			<P><I></I> <I>Destination</I></P>
		</TD>
		<TD WIDTH="78%">
			<P>String: full path of new file including file name, or, if ending in
			"\", indicates folder name only and the
			file name will be automatically
			added.</P>
		</TD>
	</TR>
</TABLE>
<P>&nbsp;</P>
<P><FONT face=Arial><STRONG>Call AttachCopyAll(&nbsp; 
<EM>DestinationFolder </EM>) <BR>Call 
AttachMoveAll(&nbsp;<EM>DestinationFolder </EM>) <BR></STRONG><FONT size=2>Copy or move all 
attachments.&nbsp; <BR>These also double as functions returning True or 
False&nbsp; eg b = 
   AttachMoveAll("p:\orders\")<BR></FONT></FONT>
<TABLE WIDTH="100%" BORDER=1 CELLPADDING=5 CELLSPACING=3 FRAME=below RULES=rows>
  <COLGROUP>
	<COL WIDTH=56>
	<COL WIDTH=200>
	<TR VALIGN=top>
		<TD WIDTH="22%">
			<P><B>Part</B></P>
		</TD>
		<TD WIDTH="78%">
			<P><B>Description</B></P>
		</TD>
	</TR>
	<TR VALIGN=top>
		<TD WIDTH="22%">
			<P><I></I> <I>DestinationFolder</I></P>
		</TD>
		<TD WIDTH="78%">
			<P>   String:&nbsp;full path of folder to copy or move all attachments
			into.&nbsp; Should end in "\" but if
			omitted, a "\" gets automatically
			added.</P>
		</TD>
	</TR>
</TABLE></P>
<P>&nbsp;</P>
<P><FONT face=Arial><STRONG>Call AttachMoveAllRename(&nbsp;<EM>DestinationFolder 
</EM>) <BR></STRONG><FONT size=2>Move all attachments with renaming each with a 
unique auto-generated name.&nbsp; <BR>Also doubles as a function returning True 
or False&nbsp; eg b = AttachMoveAllRename("p:\orders\")<BR>The special purpose 
of <STRONG>AttachMoveAllRename</STRONG> is to cope with situations where a 
standard name, eg "data.txt",&nbsp;is in common use so a decoded attachment is 
at risk of being overwritten by other incoming attachments.&nbsp; 
<STRONG>AttachMoveAllRename</STRONG> moves attachments to 
<EM><STRONG>DestinationFolder</STRONG></EM> and also generates a timestamp-based 
unique name for them.<BR>You can use <STRONG>PathAttach</STRONG> as your 
<EM><STRONG>DestinationFolder</STRONG></EM> if all you want is the renaming 
without the move elsewhere,<BR>by coding: <FONT face="Courier New"><STRONG>Call 
AttachMoveAllRename(PathAttachIn)</STRONG></FONT></FONT></FONT></P>
<TABLE cellSpacing=3 cellPadding=5 rules=rows width="100%" border=1 
  frame=below><COLGROUP>
  <COL width=56>
  <COL width=200>
  
  <TR vAlign=top>
    <TD width="22%">
      <P><B>Part</B></P></TD>
    <TD width="78%">
      <P><B>Description</B></P></TD></TR>
  <TR vAlign=top>
    <TD width="22%">
      <P><I></I><I>DestinationFolder</I></P></TD>
    <TD width="78%">
      <P>String:&nbsp;full path of folder to copy or move all attachments 
      into.&nbsp; Should end in "\" but if omitted, a "\" gets automatically 
      added.</P></TD></TR></TABLE>
<P><BR><FONT face=Arial><STRONG>MsgFile<BR></STRONG><FONT 
size=2>Name of the base message file</FONT><BR><STRONG>Msg</STRONG><BR><FONT 
size=2>Complete text of the base 
message</FONT><BR><STRONG>Header<BR></STRONG><FONT size=2>Full Header text of 
the base message, <BR>Also has optional argument (case insensitive) with which it can extract 
header values:<BR> <STRONG>Header("Date"), Header("To"), 
Header("From"), Header("Subject"), <BR> Header("CC"), Header("BCC"), 
Header("X-Attachments")<BR></STRONG></FONT><STRONG>Body<BR></STRONG><FONT size=2>Body text of the base message<BR><BR><BR> 
    </FONT></FONT></P>
<P><FONT FACE="Arial"><STRONG>Call MsgCopy(&nbsp; 
<EM>Destination </EM>) 
<BR>Call MsgMove(&nbsp; 
<EM>Destination </EM>) </STRONG><BR><FONT size=2>Copy 
or&nbsp;move&nbsp;the base message.<BR>These also double as functions returning 
True or False&nbsp; eg b = MsgMove("p:\orders\")<BR></FONT></FONT>
<TABLE WIDTH="100%" BORDER=1 CELLPADDING=5 CELLSPACING=3 FRAME=below RULES=rows>
  <COLGROUP>
	<COL WIDTH=56>
	<COL WIDTH=200>
	<TR VALIGN=top>
		<TD WIDTH="22%">
			<P><B>Part</B></P>
		</TD>
		<TD WIDTH="78%">
			<P><B>Description</B></P>
		</TD>
	</TR>
	<TR VALIGN=top>
		<TD WIDTH="22%">
			<P><I></I> <I>Destination</I></P>
		</TD>
		<TD WIDTH="78%">
			<P>String: full path of new file including file name, or, if ending in
			"\", indicates folder name only and the
			file name will be automatically
			appended.</P>
		</TD>
	</TR>
</TABLE></P>
<P>&nbsp;</P>
<P></STRONG></FONT><FONT FACE="Arial"><STRONG>PathHome<BR>PathMsgIn<BR>PathMsgOut<BR>PathAttachIn<BR>PathAttachOut<BR>PathExtMap<BR>PathExtMapArchive<BR>PathExtMapReject<BR></STRONG></FONT>String properties getting or setting full 
folder paths ending with "\".<BR>We anticipate that you would usually only want 
to read these to&nbsp;find<BR>your files, but you could also use this scripting 
to re-define them by&nbsp;<BR>  remote control when you 
send command emails to PixieRobot.&nbsp; <BR>
      
    eg:<BR><FONT 
size=2><STRONG><FONT FACE="Courier New">PathExtMap 
=&nbsp;PathHome &amp; "extmap\"&nbsp; 'define an extmap folder<BR
>           </FONT><FONT FACE="Courier New">PathAttachOut = 
    "C:\D3Shared\Transfer\AttachOut\"</FONT></STRONG></FONT></P>
<P><FONT face="Courier New" > <BR></FONT><FONT 
face=Arial><STRONG>RawLinesNumber<BR></STRONG><FONT size=2>Number of lines in the 
original raw message including coded 
attachments.<BR></FONT><STRONG>RawLine(Index)<BR></STRONG><FONT size=2>
      
         String value of raw message line, Index between 1 
and RawLineNumber<BR>eg to reconstruct the raw message 