Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCocoa/AppleScript/NSAppleScriptMBS query Mail mailboxes
Function:
Required plugins for this example: MBS MacBase Plugin, MBS MacCocoa Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/AppleScript/NSAppleScriptMBS query Mail mailboxes
This example is the version from Sun, 17th Mar 2012.
Project "NSAppleScriptMBS query Mail mailboxes.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open() if not TargetMachO then MsgBox "This example is only for Mac." end if End EventHandler
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Open() dim source as string = "tell application ""Mail"""+EndOfLine.Macintosh+"return mailboxes"+EndOfLine.Macintosh+"end tell" dim n as new NSAppleScriptMBS(source) dim d as Dictionary dim result as NSAppleEventDescriptorMBS = n.execute(d) if d<>nil then MsgBox d.Value(NSAppleScriptMBS.NSAppleScriptErrorMessage) else 'MsgBox result.description dim count as integer = result.numberOfItems dim names() as string for i as integer = 1 to count dim item as NSAppleEventDescriptorMBS = result.descriptorAtIndex(i) dim value as NSAppleEventDescriptorMBS = item.descriptorForKeyword("seld") list.addrow value.stringValue next end if End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS MacCocoa Plugin.





Links
MBS Xojo tutorial videos