|
LXBeams Scripting Support Introduction The scripting support built into LXBeams allows you to access the same information that is displayed in the Inspector's Measurements and Info tabs. There are five commands that accomplish this:
AppleScript is not designed to be fast. However, it allows the creation of customized commands through simple scripts. Quite powerful tasks can be accomplished simply by retrieving information from an object, making a decision, and setting another property based on the result. Some useful examples of how this works with LXBeams are included in this folder. Accessing Objects in LXBeams You can retrieve a documents positions and lights simply by referring to them: set my_lights to the lights of the front document set my_positions to the positions of the front document As with creating reports in LXBeams, only objects in layers that are visible are returned. You can also retrieve only some lights which contain specific text in one of their fields. ( this is much faster than using a script to step through a list of lights and using getInfo). To retrieve only certain lights takes two steps. First you specify the key and what that field must contain. Then, you retrieve the results much like getting all the lights: tell the front document to setSomeLights key "color" contains "R80" set my_lights to somelights of the front document Accessing the Scriptable Properties of LXBeams Objects Properties accessed by using keys to specify the field you are getting or setting:
Some light properties can be accessed directly as indicated in LXBeams's AppleScript dictionary. The values returned by this method for the channel, dimmer and circuit are all numeric rather than text: set my_channel to the channel of my_light --returns a number set my_channel to my_light getInfo key "chan" --returns a string
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||