hammerspoon2-docs
    Preparing search index...

    Class HSSpotlightItem

    An individual result returned by a Spotlight query. Instances are returned by HSSpotlightQuery.results() and related methods. Do not instantiate HSSpotlightItem directly. Metadata values are read via valueForAttribute() using standard kMDItem* keys. Call attributes() to discover which keys are populated on a particular item. Common attribute key shortcuts live in hs.spotlight.attribute.

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    identifier: string

    A unique identifier for this result object (UUID string).

    Methods

    • Returns the list of metadata attribute names present on this item. The list is typically not exhaustive — some attributes (such as kMDItemPath) may be readable via valueForAttribute() even when absent from this list.

      Returns string[]

      An array of attribute name strings

    • Returns the value for a specific metadata attribute, or null if absent. The return type depends on the attribute: common types include strings, numbers, dates, and arrays of strings. NSURL-typed values are automatically converted to their string representation.

      Parameters

      • key: string

        An attribute key such as "kMDItemPath" or hs.spotlight.attribute.path

      Returns any

      The attribute value, or null