ScriptPro Editor

This topic is for use by scriptwriters who are using ScriptPro Editor to create custom scripts for their agencies.

Agents can go to Using ScriptPro Scripts for more information about using custom or standard scripts within Travelport Smartpoint.

 

Mail Commands 

Mail functions enable sending, reading, locating, saving and deleting Microsoft Mail messages.

MAILADDRESS

Function

Displays the MS Mail Address dialog with the list of recipients and prompts for additional recipients.

Syntax 

MAILADDRESS (string_variable, number_variable)

  • string_variable specifies a variable containing the recipient(s) (e.g., corp_contact) or @ filename.
  • number_variable returns:
    • 0 if the user selected Cancel, Escape, or closed the Mail dialog.
    • 1 if the user selected the OK button.

Example

MAILADDRESS (corp_contact, RET_CODE)

See Additional Mail Command Examples for more examples.

MAILDATE

Function

Returns the date the message was originally received.

Syntax 

MAILDATE (string_variable, date_variable, number_variable)

  • string_variable contains the MsgID of the mail message to locate.
  • date_variable returns the date of the message identified by the MsgID.
  • number_variable returns:
    • 1 if the message was located.
    • 0 if the message could not be located.

Example

MAILDATE (message_iden, msg_date, RET_CODE)

The function locates the message based on the MsgID located in message_iden.  The date is returned in msg_date and RET_CODE contains the return code.

See Additional Mail Command Examples for more examples.

MAILDELETE

Function

Deletes the message identified by MsgID.

Syntax 

MAILDELETE (string_variable, number_variable)

  • string_variable contains the MsgID of the message to be deleted.
  • number_variable returns:
    • 1 if the file was deleted.
    • 0 if no message matched the MsgID.

Example

MAILDELETE  (message_iden, RET_CODE)

The function deletes the mail message matching the MsgID contained in message_iden.  RET_CODE contains the return code.

See Additional Mail Command Examples for more examples.

MAILFIND

Function

Retrieves a message based on a keyword.  The keyword is not case sensitive.  If Keyword and MsgID are blank (e.g., ""), the first message is returned based on the ReadFlag parameter.  If the Keyword is blank (e.g., "") and MsgID has a value, the first message following the MsgID is returned.  The MsgID is a unique identifier for a mail message.

Note:  This function can be time consuming when searching through all mail.  Limit the search by searching new files only or by setting the flag to search based on the from or subject field.

Syntax 

  • keyword indicates the word to search.
  • Search_style indicates the field to search. 
    • MM_FROM - the from field
    • MM_SUBJECT - the subject field
    • MM_MESSAGE - the text field
    • MM_ALL - the From, Subject and Text fields in the mail message
  • mail_type indicates the type of message to search. 
    • MM_NEW - all unread mail
    • MM_ALL - all mail in the Inbox
  • String_variable2 contains the MsgID of the last message found.  If empty, the search begins with the first unread message.  When the function returns, it contains the MsgID of the found message.
  • number_variable1 returns:
    • 1 if the returned mail has been read.
    • 0 if the returned mail has not been read.
  • number_variable2 returns:
    • 1 if a match was found.
    • 0 if a match was not found.

Example

MAILFIND ("Coke", MM_SUBJECT, MM_NEW, msg_id, read_ind, RET_CODE)

This function searches for the keyword "Coke" in the subject field of all unread mail starting with the first unread message.  Read_ind and RET_CODE contains the return codes.

See Additional Mail Command Examples for more examples.

MAILLOGOFF

Function

Logs off of MS Mail.  This can be used in a script to close the mail session before terminating.  Otherwise, logging off is handled at the completion of the script.

Syntax 

MAILLOGOFF

Example

MAILLOGOFF

The function logs out of MS Mail.

MAILLOGON

Function

Logs on MS Mail with the specified User Name and password.  Both parameters are case sensitive.

Syntax 

MAILLOGON (string_type1, string_type2)

  • string_type1 specifies the MS Mail User Name to logon (e.g., "Robert Anderson") or a variable containing the User Name (e.g., logon_name).
  • string_type2 specifies the MS Mail Password for the User Name (e.g., "password") or a variable containing the MS Mail Password for the User Name (e.g., logon_password).

Example

MAILLOGON (logon_name, "password")

The function logs into MS Mail with logon_name and "password."

MAILREAD 

Function

Reads a message into the appropriate strings.  If the text, recipients or attachments list is too long (i.e., greater than 255 characters), the string contains the name of a temporary file which contains the information (e.g. @temp.fil).  If there is no mail in the Inbox or a MsgID match is not found, the RET_CODE is set to 0.

Syntax 

MAILREAD (string_variable1, string_variable2, string_variable3, string_variable4, string_variable5, string_variable6, number_variable)

  • string_variable1 contains the MsgID of the last message read.  If empty, the function reads the first unread mail message.  If all mail has been read, the first mail message is read.
  • string_variable2 contains the senders Mailbox name.
  • string_variable3 contains the recipient(s) delimited by semicolon or @filename containing a list of the recipients.
  • string_variable4 contains the subject information.
  • string_variable5 contains the text of the mail message or @filename containing the text.
  • string_variable6 specifies the filename(s) of the attachment(s) delimited by a semicolon or @filename containing a list of the attachments.
  • number_variable returns:
    • 1 if a match was found.
    • 0 if a match was not found.

Example

MAILREAD (msg_iden, sender, recip, subject, mail_text, attach, RET_CODE)

The function reads in the first unread mail message when "msg_iden" is empty.  The sender, subject, text and attachment information are stored in the fields designated in the function call.  RET_CODE contains the return code.

See Additional Mail Command Examples for more examples.

MAILSAVE

Function

Saves information to the message identified by the MsgID.

Syntax 

MAILSAVE (string_variable1,  string_type2, string_type3, string_type4, string_type5, number_variable)

  • string_variable1 contains the ID of the message to save information.  If empty, a new message is saved and the new message identifier is returned in this field.
  • string_type2 specifies the recipient(s) delimited by semicolon (e.g., "Scott Kelley; Bruce Bettis") or @filename containing a list of the recipients (e.g., "@corp.lst") or a variable containing the recipient (e.g., corp_contact).
  • string_type3 specifies the subject (e.g., "Dallas Trip") or a variable containing the subject (e.g., trip_subject).
  • string_type4 specifies the text (e.g., "We booked your itinerary.  Please contact us for questions.") or @filename containing the text (e.g., "@itin.txt") or a variable containing the text (e.g., trip_text).
  • string_type5 specifies the filename(s) of the attachment(s) delimited by a semicolon (e.g., "itin1.doc; itin2.doc") or @filename containing a list of the attachments (e.g.,  "@itin.lst") or a variable containing the filename of the attachment (e.g., itinerary_doc).
  • number_variable returns:
    • 1 if the existing file or a new file was saved.
    • 0 if the file was not saved because no match was found on the MsgID.

Example

MAILSAVE (message_iden, "@recip.lst", dallas_subject, trip_text, "", RET_CODE)

The function saves the information indicated in the to, subject, text and attachment fields to the mail message identified in message_iden.  RET_CODE contains the return code.

MAILSEND

Function

Sends a mail message with optional attachments.

Syntax 

MAILSEND (string_type1, string_type2, string_type3, string_type4, dialog_style, number_variable)

  • string_variable1 specifies the recipient(s) delimited by semicolon (e.g., "Scott Kelley; Robert Anderson") or @filename containing a list of recipients (e.g., "@corp.lst") or a variable containing the recipient (e.g., corp_contact).
  • string_type2 specifies the subject (e.g., "Dallas Trip") or a variable containing the subject (e.g. trip_subject).
  • string_type3 specifies the text (e.g., "We booked your itinerary.  Please contact us for questions.") or @filename containing the text (e.g., "@itin.txt") or a variable containing the text (e.g., trip_text).
  • string_type4 specifies the filename(s) of the attachment(s) delimited by a semicolon (e.g., "itin1.doc; itin2.doc") or @filename containing a list of the attachments (e.g.,  "@itin.lst") or a variable containing the filename of the attachment (e.g., itinerary_doc).
  • dialog_style indicates if the Send Note dialog should display.

    • TRUE - always display dialog and
    • FALSE - only displays dialog if the To, Subject or Text field is blank.

  • number_variable returns:
    • 0 if the user selected Cancel, Escape or closed the Mail dialog.
    • 1 if the user selected the OK button or no dialog was displayed.

Note:  Using "@filename" enables storing information in a file such as a list of recipients or filenames.  The file must delimit each field with a semicolon or a carriage return and line feed.

Example

MAILSEND ("Lori Tracy", cruise_subject, "In May, we are offering a 7 day, 6 night cruise to Mexico for only $795.  Please read the attachment for additional information.", cruise.may, TRUE, RET_CODE)

The function above sends a mail to "Lori Tracy" with the subject contained in cruise_subject, the text "In May,...", the attachment file "cruise.may", the Send Note dialog always displays and RET_CODE contains the return code.

 

MAILSEND ("@coke.emp", avis_special, avis_special_text," c:\car\avis.txt", TRUE, RET_CODE)

The function above sends a mail to the recipients listed in the "coke.emp" file with the subject contained in "avis_special", the text contained in "avis_special_text", the attachment file "c:\car\avis.txt", the Send Note dialog always displays and RET_CODE contains the return code.

See Additional Mail Command Examples for more examples.

MAILWAIT

Function

Causes the script to pause until new mail arrives or unread mail is found.

Syntax 

MAILWAIT (string_variable)

string_variable returns the MsgID of the first unread message or new message.

Example

MAILWAIT (message_iden)

The function waits until a new mail is received and returns the MsgID in message_iden.

See Additional Mail Command Examples for more examples.