Premise [download] Module: Soup To Nuts

Motorola Premise

123

Senior Member
index.php
File Name: Module: Soup To Nuts
File Submitter: 123
File Submitted: 02 Jan 2012
File Category: Premise
Author: 123
Contact: Support forum or PM me.
Version: 1.0

Soup To Nuts: A bowl full of goodies.

Being the complex stew that it is, Premise has tasty morsels hidden below the obvious bits of meat and potatoes. Dip your spoon a little deeper and you'll discover new flavours you never knew existed.

Premise's HSDK API reference describes the programming model for would-be driver developers. Among many other things, it documents "PremiseObject" which is the core class from which all-things-Premise are derived. About 95% of PremiseObject's methods are documented in Builder's Help. What about the remaining 5%? Chopped liver? Nope; much tastier than that.

The attached Module is called "SoupToNuts" and demonstrates several useful PremiseObject methods that are not documented in Builder. Add spice to your scripts and modules with these 'new' ingredients:

GetObjectByIndex
Returns the nth object from a collection. You can specify the object's class which is useful if the collection contains objects derived from different classes.

InsertEx
Inserts a new object among other objects (i.e. creates the object precisely where you want it and not simply as the last one).

GetObjectCount
Returns the number of objects in a collection. You can specify the object's class.

SortByProperty
Sort a collection by a property name. My favourite discovery!

MoveEx
Move an object to a new position.

GetFlags
Reports the object's flags (i.e. No delete, no copy, no rename, etc).

SetsFlags
Sets an object's flags.

Bon appetit!

Click here to download this file
 
Nice job! Very creative on the naming convention(s).

A quick and obvious(?) use would be for counting number of albums, photos, lights, etc.

It's not clear to me yet on how one would invoke the soup du jour ^_^ ...any tips or examples?
 
This is very useful. In fact, so much so that I'm going to use GetObjectCount in a weather module to clean the code up some. Thanks.
 
Back
Top