User Tools

Site Tools


xtension_manual:attachments

The Attachments Script

This is the 'hook' in XTension which allows you to create your own verb handlers or alter the handling og existing XTension verbs.

If you are adept with AppleScript you can create functions which integrate other applications or peripherals and thus your own custom interface to your home automation system.

There are 2 ways to create or edit an attachments script. From the Global Scripts menu select “Edit Attachments” or double click the “Attachments” line in the manage global scripts window.

Following is a simple example of just how you might create a pair of “handlers” which would allow you to set and query a value of any type.

The Attachments Script Editor

Once you've created a “handler” (which is AppleScript's term for a subroutine or a new command) you can use that new command from any other script in XTension. The Attachments script is the 'parent' of every other script. If you create properties or constants those will also be available to all other scripts.

When the database is saved the context of the scripts are saved as well so any changes or updates to properties in the attachments or anywhere are saved and will be restored after a restart. This is one way to create lists, values, text strings, reports etc which are 'outside' the current scope of XTension's capabilities.

In this example, if you have iChat open to your XTension server you might now want to have it send a line to iChat when things happen. For example in a motion sensor ON script you might now add:

  chatBuddy( "JamesSentman", "Someone is at the front door")
xtension_manual/attachments.txt · Last modified: 2023/02/13 14:52 by 127.0.0.1