Platforms to show: All Mac Windows Linux Cross-Platform
/MacOSX/Spotlight/Spotlight File Info
Required plugins for this example: MBS MacOSX Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacOSX/Spotlight/Spotlight File Info
This example is the version from Thu, 6th Apr 2016.
Project "Spotlight File Info.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
// you can load
'dim f as FolderItem = GetFolderItem("/Developer/Applications/Xcode.app/Contents/Library/Spotlight/SourceCode.mdimporter", FolderItem.PathTypeShell)
'
'if f.SpotLightLoadMDImporterMBS then
'MsgBox "Loaded SourceCode importer."
'end if
End EventHandler
EventHandler Sub OpenDocument(item As FolderItem)
window1.run item
End EventHandler
End Class
Class Window1 Inherits Window
Control EditField1 Inherits TextArea
ControlInstance EditField1 Inherits TextArea
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub DropObject(obj As DragItem, action As Integer)
do
if obj.FolderItemAvailable then
run obj.FolderItem
end if
loop until not obj.NextItem
End EventHandler
EventHandler Sub Open()
'run GetFolderItem("Spotlight File Info.rbp")
me.AcceptFileDrop FileTypes1.Any
End EventHandler
Sub run(f as FolderItem)
dim s as string
if f<>nil then
s = f.SpotLightTextContentMBS
if len(s) = 0 then
s = f.SpotLightTextContentMBS("public.plain-text")
end if
end if
EditField1.text = s
List.DeleteAllRows
dim d as Dictionary = f.SpotLightFileInfoMBS
if d = nil then
d = f.SpotLightFileInfoMBS("public.plain-text")
end if
if d<>nil then
for each key as Variant in d.Keys
dim value as Variant = d.Value(key)
dim type as integer = VarType(value)
List.AddRow key.StringValue
Select case type
case 0 // nil
List.Cell(List.LastIndex,1)="nil"
case 4105 // array of Variants
dim v(-1) as Variant = value
dim texts(-1) as string
for each vv as Variant in v
texts.Append vv.StringValue
next
List.Cell(List.LastIndex,1)=Join(texts,", ")
else
// all other data types like string or numbers
List.Cell(List.LastIndex,1)=value.StringValue
end Select
next
end if
End Sub
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
FileTypes1
Filetype special/any
End FileTypes1
End Project
The items on this page are in the following plugins: MBS MacOSX Plugin.