Class
SpotlightItem
Description
Used to manage results from a SpotlightQuery. Supported only on macOS. It does nothing on other operating systems.
Properties
Name |
Type |
Read-Only |
Shared |
---|---|---|---|
✓ |
|||
✓ |
Property descriptions
SpotlightItem.File
File As FolderItem
References the file that this SpotlightItem represents.
This property is read-only.
This example uses File to access two items for each file in the loop.
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.CellTextAt(ListBox1.LastAddedRowIndex, 1) = query.Item(i).Value("kMDItemDurationSeconds")
Next
Exception e As SpotlightException
MessageBox("A Spotlight error occurred.")
SpotlightItem.Handle
Handle As Integer
Returns a handle to an MDItemRef.
This property is read-only.
This can be used in Declare statements to access features that are not provided by SpotlightQuery.
Method descriptions
SpotlightItem.Value
Value(key As String) As Variant
Returns the value of the specified property.
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.
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.CellTextAt(ListBox1.LastAddedRowIndex, 1) = query.Item(i).Value("kMDItemDurationSeconds")
Next
Exception e As SpotlightException
MessageBox("A Spotlight error occurred.")
Compatibility
All project types on all supported operating systems.
See also
object parent class; SpotlightException, SpotlightQuery classes.