XTension Logo

You have more than one Mac in the house ?

Using the target and monitor features of XTension, it is possible to monitor and control your system from any other Mac on your local AppleTalk network.

The 'set target' verb is used to tell XTension to send all events that occur in the system to another copy of XTension running on a different 'monitor' Mac. From then on, any events that the 'host' detects will be sent to the 'monitor' copy of XTension as 'apple events'

These events will be reflected as changes in the 'local' database, as well as changes in any icons or indicators of those database items.

If the monitor copy of XTension also sets its 'target' back to the 'host', then any manual commands from the mouse or keyboard of the 'monitor' Mac will be sent to the 'host' for actual processing.

Thus, from a remote Mac (even dial-in), you can monitor and control the 'host' as if you were actually there.

This 'targeting' feature can be set manually in the preferences, or it can be set up from a script. See the example below.

Once you have the ability to dynamically connect to the 'host', you realize that the databases are likely not 'in sync'. While the 'monitor' was asleep, the host continued to change the database. This is potentially a very confusing situation.

Using the XTension 'save snapshot' and 'load snapshot' verbs, you can cause the 'host' to save a snapshot of just the current values and states of all database units. This snapshot is a small file, and can be transferred quickly to the monitor Mac.

Then we issue the 'load snapshot' verb at the monitor Mac and the two databases are now 'in sync'.

This separation of the two functions also allows you to save a snapshot of the database at any time as a 'picture' of the state of all units at a particular time. This might be some exception like a robbery, and you would be able to 'load snapshot' and review the conditions from that time as well as the log file.

Following is a simple picture of the physical setup for the tutorial :

Note that you need not have X-10 interfaces on each Mac. However, it is not only possible, but is also nicely 'redundant' !

You could of course use Ethernet or AppleTalk Remote Access?

The example below is as 'generic' as possible, but you will have to make some modifications for your specific machine/user names etc.

Making it simple:

This tutorial includes a 'plug-in'. This file actually includes several files which are necessary for this to all work. All scripts are already written, but you will have to make some changes in the names of the Macs and their hard disks, and the name of the AppleTalk zones (if any).

Here's where you download the plug-in.

The items in the download package:

AutoGuest Init

This file must be put into the Extensions folder of both Macs. It allows the two Macs to 'sign on' to each other as "Guest" and exchange files.

You must remember however that you have to turn on "Program Linking", in the "Sharing Setup" control panel anytime you want to allow Macs to send "AppleEvents" to each other. Like now.

SendFile - an AppleScript OSAX

This OSAX (AppleScript verb - add on), provides a single verb "ftsend", which can send a file to another Mac. It will be used in the "Startup Script" below, but must first be moved into your System Folder:Extensions:Scripting Additions: folder.

Receiver - a small application which receives files.

This is a tiny application which must be running on the Mac that is to 'receive' files from the "SendFile" osax above. They work together very nicely. You must either make "Receiver" a 'startup item' for the Mac, or you must have XTension activate it (like in the Startup Script), just before running the example ...

The 'multimacs' plug-in

This plug-in contains only the Startup and Shutdown scripts which must be installed in the Monitor copy of XTension.

The "Startup Script" is the principal point of interest here in that it is automatically run by XTension at each startup. Both scripts must be run ONLY by the 'monitor' copy of XTension. The 'host' copy of XTension will have different scripts.

All of the plug-in files (with the exception of the "Startup" and "Shutdown" scripts) must be put into both Macs, and you must remember to restart after putting everything in their proper places :

Here's the sequence for installation and setup:

This is just a screen shot of the desktop of the machine which is the 'Monitor' for this tutorial...

This shows all of the required elements for this tutorial, with the exception of "SendFile" which is in the "Scripting Additions" folder.

The Startup Script

This script is the center of interest in this tutorial. This is where everything happens when we startup a 'monitor' copy of XTension.

Here, we're going to tell the 'host' copy of XTension to take a 'snapshot' of the current database values, and save that as a file called "Snap1" on the 'host' Mac disk.

This file is then transferred to the 'monitor' Mac using the "SendFile" osax, and the "Receiver" application. The file is then loaded as a 'snapshot' into the monitor database.

The two XTension databases are now 'in-sync', and all further events that occur in the 'host' Mac will be sent to the 'monitor', and everything should make sense.

Here's what it looks like after you startup XTension on the monitor Mac with the example Startup Script :

Remember that things like disks, Macs, and AppleTalk 'zones' will have to be changed for your system.

The usual blank lines were removed in order to squeeze the whole script into the window.
startup script

NOTE: There are two lines in the 'startup script' in the download, which refer to a unit named "INIT". Please just remove these as they have nothing to do with this process. They are just left-over from an earlier version.

There is no error handling here, but it is very simple, does not 'eat' disk space over time, and any errors will always be reported in the Log Window. Since you will always be running this script on a 'monitor' Mac, and you are usually there at the keyboard, elaborate error handling and recovery isn't critical here.

From the moment that the Startup Script completes, the 'host' will begin to send events to the 'monitor', where the events are treated almost as if they came from a real X-10 interface on its serial port.

The Shutdown Script

Although the 'host' copy of XTension will detect eventually that the 'monitor' Mac has died or quit, it is always nice to tell the host that you are quitting. This script simply tells the 'host' to stop sending events to this Mac and this copy of XTension.

Remember to change the names "Ransom" and "Q800" to the names of your 'host' and 'monitor' Macs respectively.

shutdown script

Ok, how about more Macs ?

Of course, you'd like to have every Mac in your house connected in the same way, but unfortunately, any copy of XTension can only 'target' one other copy of XTension at a time.

You can have other copies of XTension on other Macs which have the ability of 'targeting' the same 'host', and thus commands can be issued from those copies, but the 'host' will only be able to send 'events' to one of them at a time.

You can of course shut down the 'monitor' Mac in your office, and start up another in the den etc. A similar startup script would be used on each Mac.

The idea is that you may have a MacPlus or such as your 'host' Mac, which doesn't have the horsepower of your other Macs. It is in a closet, and doesn't need to have all of the pretty graphic windows showing.

But on your 'monitor' Mac you can have XTension display all the pretty graphics and icons that you want, and it won't bother the 'host'.

Other helpers

Below, you can download three free tools which can run on a 'monitor' Mac and can either display a log of the events on the 'host', or can send commands to it from a simple 'button pad'.

Some of these may have 'help' files :
Button Pad Simple way to send up to 9 commands to XTension from any Mac.
XTControl A mini-XTension, uses the XTension database.
AlertUser Provides a log and a target for announcing alarms.

Please let us know if there are any errors with either the tutorial or the 'plug-in'.

Back to Home Page
More Ideas

Copyright 2007, Sand Hill Engineering Inc. All rights reserved.

Mac Made

Last modified: July 1, 2007
Michael Ferguson, webmaster@shed.com