Scribe Scripting and API Documentation

Intro

To use Scribe scripting you will need to have the ICI plugin loaded. If you want to use Forms as well that the Scribe_Form plugin is required as well.

The Forms plugin uses the Scriptor plugin (in our case: ICI) to execute script in the email. It loads the first attachment with the mime type "application/x-lgi-resource" and then creates the dialog with the Id: 1 into the client area of the email. The sciptor plugin uses the first attachment with the mime type "application/x-ici".

To create a form email, create a lr8 file, make a new dialog. The ID of the dialog will be 1, which is how the forms plugin will find it. Populate the dialog with the controls you want to use in the form. You will need to reference the controls via the automatically assigned Id number in the ICI script.

Create a empty text file with the extension 'ICI' and write any event handlers that are required.

Attach the lr8 file and the ici file to a new email. By openning this new email you should see the form in the "text" tab of the mail window. And any OnLoad implementation will have been called.

Types

Types available in ICI forms:
GView Properties (Get & Set):
  • String Name
  • Int Value
  • Int Enabled
  • Int Visible
  • Int Id
Properties (Get):
  • GView Window
  • GView Parent
Methods:
  • GView FindView(Int Id) // Finds a child view by Id
  • void Close() // Closes the window
  • void Msg(String Text) // Displays a string in a Message Box
GMouse Properties (Get):
  • Int x
  • Int y
  • Int Left
  • Int Right
  • Int Middle
  • Int Down
  • Int Double
GKey Properties (Get):
  • Int c // The utf-16 character code
  • Int Down // Non zero if the key is down
Thing

Object::Mail, Object::Contact and Object::Calendar all inherit from 'Thing'.

The properties available are documented in the Scribe DOM.

Methods that apply to any 'Thing':

  • void Delete() // Deletes the object to the trash
  • void MoveTo(String NewFolderPath) // Moves the object to a different folder
  • void Save() // Saves changes to the object
Methods specific to a Mail 'Thing':
  • void SetRead()
  • void Send() // Moves the email to the outbox and sends it
  • void AddTo(String EmailAddress) // Adds a recipient

Functions

These functions are available in ICI forms:
SMsg(Text) Displays a windows message box.
SGetFilterMail() Returns the Object::Mail currently being filtered. Not applicable to Forms Scripting.
SCreateThing(Type, Folder) Creates a Scribe object of 'Type' in the folder 'Folder'. Available types are:
  • "Mail"
  • "Contact"
  • "Calendar"
The folder can be something like:
  • "/Inbox"
  • "/My Mail/Friends"
SGetDom(DomField) Gets a DOM field. Used in filtering only.
SRunFilterActions() Runs the actions on the current filter. Once you have tested the input mail in your filter, call this to execute the actions setup on the filter. Otherwise you can call various API functions on the mail itself to acheive the same results, but seeing as there is already a reasonable UI on the filter action list why not use it.

Events

The events are called in ICI forms:
OnLoad(GView Form)

Form - GView containing all the fields in the lr8 resource id '1'.
Called when the form is on the screen.
OnUnload(GView Form)

Form - GView containing all the fields in the lr8 resource id '1'.
Called before the form is removed from the screen.
OnMouseClick(GView Ctrl, GMouse Mouse)
Called when the user clicks on a control.
OnMouseEnter(GView Ctrl, GMouse Mouse)
Called when the mouse enters the area of the screen occupied by a control.
OnMouseExit(GView Ctrl, GMouse Mouse)
Called when the mouse exits the area of the screen occupied by a control.
OnMouseWheel(GView Ctrl, Float Lines)

Ctrl - GView object.
Lines - A float describing the lines scrolled.
Called when the user scrolls with the mouse wheel.
OnFocus(GView Ctrl, Bool In)

Ctrl - GView object.
In - An int, true if the focus is being aquired.
Called when the control gains and loses focus.
OnPosChange(GView Ctrl)
Called when a control changes position.
OnNotify(GView Ctrl, Int Flags)
Called when a control notifies it's parent of something. Usually this is called when a controls value has changed or a control has been activated.