SpotlightItem.Value

From Xojo Documentation

Method

SpotlightItem.Value(PropertyName as String) As Variant

Supported for all project types and targets.

Returns the value of the specified property.

Notes

The properties can be any of the ones listed in MDItem.h or any custom properties. Value returns Nil if the specified property is not present.

Example

This example displays the name and the duration of the audio file in a ListBox.

Var query As New SpotlightQuery("kMDItemContentTypeTree == 'public.audio'")
query.Synchronous = True
query.Run
For i As Integer = 0 To query.Count - 1
ListBox1.AddRow(query.Item(i).File.DisplayName)
ListBox1.CellValueAt(ListBox1.LastAddedRowIndex, 1) = query.Item(i).Value("kMDItemDurationSeconds")
Next

Exception e As SpotlightException
MessageBox("A Spotlight error occurred.")