docs » hs.spotlight.item
This sub-module is used to access the individual results of a spotlightObject or a spotlightGroupObject.
Each Spotlight item contains attributes which you can access with the hs.spotlight.item:valueForAttribute method. An array containing common attributes for the type of entity the item represents can be retrieved with the hs.spotlight.item:attributes method, however this list of attributes is usually not a complete list of the attributes available for a given spotlightItemObject. Many of the known attribute names are included in the hs.spotlight.commonAttributeKeys
constant array, but even this is not an exhaustive list -- an application may create and assign any key it wishes to an entity for inclusion in the Spotlight metadata database.
For convenience, metamethods have been added to the spotlightItemObjects as a shortcut to the hs.spotlight.item:valueForAttribute method; e.g. you can access the value of a specific attribute by treating the attribute as a key name: spotlightItemObject.kMDItemPath
will return the path to the entity the spotlightItemObject refers to.
- Methods - API calls which can only be made on an object returned by a constructor
- attributes
- valueForAttribute
Signature | hs.spotlight.item:attributes() -> table |
---|---|
Type | Method |
Description | Returns a list of attributes associated with the spotlightItemObject |
Parameters |
|
Returns |
|
Notes |
|
Signature | hs.spotlight.item:valueForAttribute(attribute) -> value |
---|---|
Type | Method |
Description | Returns the value for the specified attribute of the spotlightItemObject |
Parameters |
|
Returns |
|
Notes |
|